Skip to content

Commit

Permalink
Add: bounds checking for predicted values
Browse files Browse the repository at this point in the history
  • Loading branch information
LacombeLouis committed Feb 7, 2024
1 parent 8dcf71b commit 02fc562
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mapie/regression/quantile_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ def predict(
)
for i, est in enumerate(self.estimators_):
y_preds[i] = est.predict(X)
check_lower_upper_bounds(y_preds[0], y_preds[1], y_preds[2])
if symmetry:
quantile = np.full(
2,
Expand All @@ -716,5 +717,5 @@ def predict(
)
y_pred_low = y_preds[0][:, np.newaxis] - quantile[0]
y_pred_up = y_preds[1][:, np.newaxis] + quantile[1]
check_lower_upper_bounds(y_preds, y_pred_low, y_pred_up)
check_lower_upper_bounds(y_pred_low, y_pred_up, y_preds[2])
return y_preds[2], np.stack([y_pred_low, y_pred_up], axis=1)

0 comments on commit 02fc562

Please sign in to comment.