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

ENH: Refactorization of MapieRegressor and ConformityScore #325

Merged

Conversation

candicemyt
Copy link
Collaborator

@candicemyt candicemyt commented Jul 6, 2023

Description

The ConformityScore class called by MapieRegressor does not allow the scores to be calculated from X (only from y_pred).

To solve this problem a refactorization of MapieRegressor has been done : MapieRegressor now calls the EnsembleEstimator (defined in regression/estimator.py) that handle the training and usage of the estimator. The ConformityScore class is also modified : it now takes X and EnsembleEstimator in parameters.
Finally, the quantile calculation is intuitive according to the method (plus, base, minmax).

Fixes #317

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit testing of regression and conformity_scores
  • Check the classes depending on MapieRegressor (time_series, quantile_regression)

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

@candicemyt candicemyt linked an issue Jul 6, 2023 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Jul 6, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (1861c8c) 100.00% compared to head (45eee11) 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##            master      #325    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           32        34     +2     
  Lines         3775      3881   +106     
  Branches       406       413     +7     
==========================================
+ Hits          3775      3881   +106     
Impacted Files Coverage Δ
mapie/conformity_scores/conformity_scores.py 100.00% <100.00%> (ø)
...ie/conformity_scores/residual_conformity_scores.py 100.00% <100.00%> (ø)
mapie/estimator/estimator.py 100.00% <100.00%> (ø)
mapie/estimator/interface.py 100.00% <100.00%> (ø)
mapie/regression/regression.py 100.00% <100.00%> (ø)
mapie/regression/time_series_regression.py 100.00% <100.00%> (ø)
mapie/tests/test_common.py 100.00% <100.00%> (ø)
mapie/tests/test_conformity_scores.py 100.00% <100.00%> (ø)
mapie/tests/test_regression.py 100.00% <100.00%> (ø)
mapie/tests/test_time_series_regression.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@candicemyt candicemyt self-assigned this Jul 6, 2023
@thibaultcordier thibaultcordier changed the title 317 refactorization of mapieregressor and conformityscore ENH: Refactorization of MapieRegressor and ConformityScore Jul 6, 2023
@thibaultcordier thibaultcordier marked this pull request as draft July 6, 2023 09:30
@thibaultcordier thibaultcordier added the enhancement New feature or request label Jul 6, 2023
@thibaultcordier thibaultcordier marked this pull request as ready for review July 11, 2023 08:11
Copy link
Collaborator

@thibaultcordier thibaultcordier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm only adding a few minor comments (description and moving if/else conditions). If @vincentblot28 has no further comments, I will approve the merging of these changes.

mapie/estimator/estimator.py Outdated Show resolved Hide resolved
mapie/estimator/interface.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@thibaultcordier thibaultcordier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve merging these changes. Looking forward to @vincentblot28's comments later today.

@candicemyt candicemyt merged commit cf93146 into master Jul 13, 2023
10 checks passed
@thibaultcordier thibaultcordier deleted the 317-refactorization-of-mapieregressor-and-conformityscore branch September 20, 2023 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactorization of MapieRegressor and ConformityScore
4 participants