pycsamt.ai.training.metrics#
Evaluation metrics for 1-D EM inversion networks.
All functions accept numpy arrays and ignore NaN entries (corresponding to padding in variable-depth datasets).
Metrics#
rmse Root mean square error on log₁₀(ρ).
mae Mean absolute error.
r2 Coefficient of determination R².
relative_rmse RMSE normalised by |y_true|.
depth_rmse RMSE weighted by inverse depth (shallower layers
are easier to recover and receive less weight).
layer_rmse Per-layer RMSE vector.
Functions
|
RMSE on the resistivity sub-vector only (first |
|
Per-column RMSE vector. |
|
Mean absolute error, ignoring NaN. |
|
MSE loss that ignores |
|
Coefficient of determination R², ignoring NaN. |
|
Normalised RMSE: |
|
Root mean square error, ignoring NaN. |
|
Compute all scalar metrics and return as a dict. |
|
Return a bool mask without importing torch at module level. |
- pycsamt.ai.training.metrics.rmse(y_true, y_pred)[source]#
Root mean square error, ignoring NaN.
Operates element-wise on
y_trueandy_pred. Both arrays are assumed to be in log₁₀(Ω·m) or normalised space.
- pycsamt.ai.training.metrics.r2(y_true, y_pred)[source]#
Coefficient of determination R², ignoring NaN.
- pycsamt.ai.training.metrics.relative_rmse(y_true, y_pred)[source]#
Normalised RMSE:
sqrt(mean((y_true - y_pred)² / y_true²)).Useful when comparing models with very different resistivity ranges.
- pycsamt.ai.training.metrics.depth_rmse(y_true, y_pred, n_layers, *, depth_weight=True)[source]#
RMSE on the resistivity sub-vector only (first
n_layerscolumns), optionally weighted by layer index so that deeper (harder) layers have less influence on the score.
- pycsamt.ai.training.metrics.masked_mse_loss(pred, target)[source]#
MSE loss that ignores
NaN(padding) entries in target.