-
Notifications
You must be signed in to change notification settings - Fork 39
isotonic calibration #795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/v4.0.0
Are you sure you want to change the base?
isotonic calibration #795
Conversation
Signed-off-by: Fleur Petit <fleur.petit@alliander.com>
Signed-off-by: Fleur Petit <fleur.petit@alliander.com>
4bd91ed to
469f92c
Compare
…73-calibration-isotonic-quantile
...penstef-models/src/openstef_models/transforms/postprocessing/isotonic_quantile_calibrator.py
Show resolved
Hide resolved
...penstef-models/src/openstef_models/transforms/postprocessing/isotonic_quantile_calibrator.py
Show resolved
Hide resolved
| # Remove NaN values (required for IsotonicRegression) | ||
| mask = ~(np.isnan(predictions) | np.isnan(actuals)) | ||
| predictions_clean = predictions[mask] | ||
| actuals_clean = actuals[mask] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calibriation can be quite tricky in case we have a very small data. To limit this risk we could introduce a warning or condition on the number of datapoints. If the fraction or absolute number of datapoints is below this threshold, we can warn the user or even skip the calibration entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .05 is a bit arbitrary, what do you think?
| Returns: | ||
| Array of locally estimated quantile values matching the input order. | ||
| """ | ||
| # Sort by predicted values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we set a lower limit on the length of the window? If we use the np.quantile we need at least 100 observations. Otherwise we risk Q50 == Q51
Summary
This PR implements a postprocessing calibration method for quantile estimation using sk-learn's IsotonicRegression.
Changes
IsotonicCalibratorto postprocessing transforms.IsotonicCalibratorfunctionality on different data with different settings.IsotonicCalibratoron observed vs expected quantilesTesting