Skip to content

ENH add support for array API to various metric #29709

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

Merged
merged 156 commits into from
Sep 27, 2024

Conversation

virchan
Copy link
Member

@virchan virchan commented Aug 23, 2024

Reference Issues/PRs

Towards #29678, #26024

What does this implement/fix? Explain your changes.

This PR updates the following functions in sklearn.metrics:

  1. MAE mean_absolute_error
  2. MAPE mean_absolute_percentage_error
  3. MSE mean_squared_error
  4. RMSE root_mean_squared_error
  5. MSLE mean_squared_log_error
  6. RMSLE root_mean_squared_log_error

Specifically:

  1. The functions MSLE and RMSLE now check whether y_true and y_pred are within the correct domain for the function $y = \log(1 + x)$, rather than $y = \log(x)$, as was previously implemented, addressing issue root_mean_squared_log_error & mean_squared_log_error: ValueError should be raised only if y_true or y_pred contain a value below -1, not below 0 #29678.
  2. The functions RMSE, MSLE, and RMSLE are now compatible with the Array API and have been added to the relevant tests, partially addressing issue Make more of the "tools" of scikit-learn Array API compatible #26024.
  3. The functions MAE, MAPE, MSE, and RMSE now explicitly check if a scalar is returned when multioutput=uniform_average.

Any other comments?

  1. This is the same as the PR Updating root_mean_squared_log_error & mean_squared_log_error #29686, which was closed due to re-branching.
  2. The description has been updated to reflect the recent changes.

`ensemble/_weight_boosting.py` file, moving it below the `Examples`
section for improved organization.

Included an AdaBoost example reference within the DecisionTree class in
the `tree/-class.py` file.
…sion Trees user guide.

- Modified the doc-string wording in the `AdaBoostClassifier` class referencing to the aforementioned example.
Copy link
Contributor

@OmarManzoor OmarManzoor left a comment

Choose a reason for hiding this comment

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

Other than the comment I added, this looks good.

@virchan virchan changed the title Updating root_mean_squared_log_error & mean_squared_log_error Updating Six Metrics Sep 11, 2024
@adrinjalali
Copy link
Member

I'd like to see what @ogrisel thinks here.

@glemaitre glemaitre changed the title Updating Six Metrics ENH add support for array API to various metric Sep 18, 2024
Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

LGTM besides the following nitpicky suggestion. I will commit it and if CI goes through, it will auto-merge.

@ogrisel ogrisel merged commit e92dd40 into scikit-learn:main Sep 27, 2024
30 checks passed
@virchan
Copy link
Member Author

virchan commented Sep 27, 2024

Thank you for your time!

@ogrisel
Copy link
Member

ogrisel commented Sep 27, 2024

I realized I merged with running the CUDA CI first... Let's be hopeful...

@ogrisel
Copy link
Member

ogrisel commented Sep 27, 2024

At least the tests pass with pytorch on MPS device, I tried locally.

@ogrisel
Copy link
Member

ogrisel commented Sep 27, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants