Skip to content

Conversation

@BaptisteCalot
Copy link
Collaborator

@BaptisteCalot BaptisteCalot commented Jun 27, 2024

Description

Adding **predict_params for the predict methods of the models.

Fixes #492

Type of change

Please remove options that are irrelevant

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

In progress

  • : Check that predict_params are correctly taken into account in the fit and predict methods
  • : Check that fit_params and predict_params are correctly taken into account in the fit and predict methods
  • : Check that an error is raise when predict_params are given to the predict method but not to the fit method

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

@BaptisteCalot BaptisteCalot marked this pull request as ready for review July 2, 2024 14:41
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.

Thank you @BaptisteCalot for your contribution to adding predict_params. Just a few suggestions:

  • check that your changes in the interface class are compatible with the regression and classification subclasses
  • check that your style code is as clear and clean as possible (too many empty lines which make it difficult to read your code)
  • use the same convention everywhere (if you don't use a comma at the end of the method signature, do it everywhere)

I question your proposal to add predict-param in initialization. For me, it is not natural or usual to do so.

@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (614293e) to head (a495462).
Report is 548 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##            master      #471    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           39        44     +5     
  Lines         4616      5255   +639     
  Branches       487       890   +403     
==========================================
+ Hits          4616      5255   +639     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Consider previous comments in any part of your changes. The list is non-exhaustive:

  • mapie/tests/test_regression.py, line 963: clean the test code by removing the unnecessary empty line
  • mapie/tests/test_regression.py, line 1023: clean the test code by removing the unnecessary empty line
  • mapie/tests/test_regression.py, line 44: use super init to reduce your code

@LacombeLouis
Copy link
Collaborator

Note that for the description of the **predict_params make sure to explain that these are the parameters for the estimator!

Copy link
Collaborator

@LacombeLouis LacombeLouis left a comment

Choose a reason for hiding this comment

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

Good! One last change and we're there!

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.

Thank you for your changes. Just one last one to add docstring into a function.



def test_invalid_predict_parameters() -> None:
"""Test that invalid predict_parameters raise errors."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're not testing that invalid predict params give an error. We're checking that if given in predict, we are also given one in fit, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see the solution on this issue. We are checking that if no predict_params have been given in the fit, it's an issue.



def test_invalid_predict_parameters() -> None:
"""Test that invalid predict_parameters raise errors."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see the solution on this issue. We are checking that if no predict_params have been given in the fit, it's an issue.

Copy link
Collaborator

@LacombeLouis LacombeLouis left a comment

Choose a reason for hiding this comment

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

Hey @BaptisteCalot, just some small updates. Note that you should make a last check for the linting, as the changes I've made don't verify linting!

@LacombeLouis LacombeLouis merged commit 603b5da into master Aug 2, 2024
@BaptisteCalot BaptisteCalot deleted the 212-predict_params_mapie_without_classification branch August 2, 2024 16:01
@LacombeLouis LacombeLouis changed the title Add predict_params into Mapie except classification files Add : **predict_params in fit and predict method for Mapie Regression Aug 26, 2024
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.

Add **predict_params into regression files

4 participants