Skip to content
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

Fixes #495 : Correct EnbPI Prediction Intervals centering #524

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jawharmohammed
Copy link

@jawharmohammed jawharmohammed commented Oct 14, 2024

Description

Addresses the issue #495 concerning the prediction intervals generated by EnbPI.

The intervals are now centered at the aggregation of y_pred_multi instead of the prediction of a single estimator, aligning with the pseudocode.

Fixes #495

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist

  • I have read the contributing guidelines
  • I have updated the HISTORY.rst and AUTHORS.rst files
  • Linting passes successfully : make lint
  • Typing passes successfully : make type-check
  • Unit tests pass successfully : make tests
  • Coverage is 100% : make coverage
  • Documentation builds successfully : make doc

@jawadhussein462 jawadhussein462 added the Discussion in progress Discussion ongoing between the Mapie team and the author. label Nov 5, 2024
@vincentblot28
Copy link
Collaborator

hi @jawharmohammed,

Thank you very much for this fix, this is great !

To improve the readability of the code, maybe you could do as following:

elif self.method == "plus":
    y_pred_multi_low = y_pred_multi
    y_pred_multi_up = y_pred_multi
elif self.method == "enbpi":
    y_pred_aggregate = aggregate_all(self.agg_function, y_pred_multi)
    y_pred_multi_low = y_pred_aggregate[:, np.newaxis]
    y_pred_multi_up = y_pred_aggregate[:, np.newaxis]
else:
    y_pred_multi_low = y_pred[:, np.newaxis]
    y_pred_multi_up = y_pred[:, np.newaxis]

if ensemble:
    y_pred = aggregate_all(self.agg_function, y_pred_multi)

This way, even if we compute the aggregated prediction twice, the code will be easier to understand :)

Now as the intervals are slightly modified, some tests return errors, but you are almost there !

Again, thank you for this fix

Vincent

@jawadhussein462 jawadhussein462 removed the Discussion in progress Discussion ongoing between the Mapie team and the author. label Nov 8, 2024
@Valentin-Laurent
Copy link
Collaborator

Hello @jawharmohammed, thank you very much for your work.
It seems that some tests are failing (namely, the linting phase, and some tests on intervals). Regarding intervals, you can modify them directly in the tests: it is normal that they change given that you corrected how they are computed.
Let us know if you need more guidance.
cc @vincentblot28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EnbPI Prediction Intervals not centered correctly
4 participants