user_defined_configs.function_loss module
This module is an example of a user-defined loss function for the Basement-Calibrator. It computes the Root Mean Square Error (RMSE) between simulated and observed water depths at specified calibration points. The function can be customized to include additional metrics, such as velocity errors, or to apply different weighting schemes.
- It is important that the function accepts the following arguments:
simulation_data: A dictionary containing the simulation results, including cell centroids and hydrodynamic properties (e.g., water depth, velocity).
ground_truth_data: A dictionary containing the observed data at calibration points.
The function should return a single float value representing the loss, which the optimization algorithm will minimize.
- user_defined_configs.function_loss.loss_function(simulation_data: dict, ground_truth_data: dict) tuple[float, DataFrame][source]
Extracts simulation data at calibration points and computes the RMSE for water depth.
- Parameters:
simulation_data (dict) – Contains simulation data (e.g., centroids and hydrodynamic properties).
ground_truth_data (dict) – Contains calibration points with known water depths.
- Returns:
The sum of RMSE values for all calibration cross-sections. (pd.Series): Optional, a series of errors for each calibration point, which can be used for further analysis or visualization.
- Return type:
float