Skip to content

DOC update wording for MAPE formula #29775

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 3 commits into from
Sep 3, 2024
Merged

Conversation

reshamas
Copy link
Member

@reshamas reshamas commented Sep 2, 2024

Copy link

github-actions bot commented Sep 2, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 17ace67. Link to the linter CI: here

@reshamas reshamas changed the title update wording for MAPE formula DOC update wording for MAPE formula Sep 2, 2024
@ogrisel
Copy link
Member

ogrisel commented Sep 3, 2024

Maybe we could explain that the motivation is to be consistent with the convention of accuracy_score that also outputs a value between 0 and 1 instead of 0 and 100.

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.

Thanks @reshamas. LGTM, irrespective of whether we take my above comment into account.

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @reshamas

@glemaitre glemaitre merged commit 2cbf334 into scikit-learn:main Sep 3, 2024
28 checks passed
@lesteve
Copy link
Member

lesteve commented Sep 4, 2024

🤔 MAPE is not in the range [0, 1], it can be arbitrarily large, right? I have to say I don't really know how to word this to make it clearer that a percentage is not returned despite the name.

Also I guess that whatever we improve should be done similarly in the docstring because I would say the reference API doc is likely where people are going to go for information first.

In [1]: from sklearn.metrics import mean_absolute_percentage_error
mes
In [2]: mean_absolute_percentage_error([1e-6, 1e-6, 1e-6], [1, 2, 3])
Out[2]: 1999999.0

@glemaitre
Copy link
Member

Indeed you can make an error of 200%. We need to reformulate and drop the notion of upper bound.

@lesteve
Copy link
Member

lesteve commented Sep 4, 2024

Maybe give an example where the error is 1 (or 100%) in the user guide to clarify that the returned value is 1 and not 100?

In [5]: mean_absolute_percentage_error([1, 2, 3], [2, 4, 6])
Out[5]: 1.0

@ogrisel
Copy link
Member

ogrisel commented Sep 4, 2024

Indeed sorry for the misleading comment. Still I think the fact that it's consistent with our convention that 1.0 returned by accuracy_score means 100%.

Any volunteer for a follow-up PR to fix this?

glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Sep 9, 2024
glemaitre pushed a commit that referenced this pull request Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants