fix(metrics): name the wrapper mock correctly and document NaN r2 with one valid pair (SIENTIAPDE-2215)
This commit is contained in:
@@ -358,7 +358,7 @@ class DataManagerRepository(SientiaMonitoring):
|
||||
behavior, assuming that predictions (y_pred/y_train_pred) are already on the
|
||||
correct scale for metric calculation (any scaling is handled inside the
|
||||
model wrapper). Pairs with a NaN target or a NaN prediction are left out of
|
||||
mse/mae/r2.
|
||||
mse/mae/r2. With a single valid pair left, r2_val is NaN (R² needs 2 samples).
|
||||
|
||||
Args:
|
||||
tmr: Training result containing:
|
||||
|
||||
@@ -343,10 +343,10 @@ def test_compute_regression_metrics_all_nan_pairs_raises():
|
||||
val_data=pd.DataFrame({'t': [1.0, 2.0]}, index=idx),
|
||||
y_pred=pd.DataFrame({'p': [np.nan, np.nan]}, index=idx),
|
||||
)
|
||||
metadata = MagicMock()
|
||||
wrapper = MagicMock()
|
||||
|
||||
with pytest.raises(ValueError, match='No validation rows with both target and prediction'):
|
||||
repo.compute_regression_metrics(tmr, metadata)
|
||||
repo.compute_regression_metrics(tmr, wrapper)
|
||||
|
||||
|
||||
def test_compute_regression_metrics_linear_equation():
|
||||
|
||||
Reference in New Issue
Block a user