Skip to content

DOC update wording for MAPE formula - #29775

Merged
glemaitre merged 3 commits into
scikit-learn:mainfrom
reshamas:rs-mape
Sep 3, 2024
Merged

glemaitre merged 3 commits into
scikit-learn:mainfrom
reshamas:rs-mape

Conversation

@reshamas

@reshamas reshamas commented Sep 2, 2024

Copy link
Copy Markdown
Member

@github-actions

github-actions Bot commented Sep 2, 2024 •

Copy link
Copy Markdown

✔️ 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

ogrisel commented Sep 3, 2024

Copy link
Copy Markdown
Member

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.

@ogrisel ogrisel left a comment

Copy link
Copy Markdown
Member

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.

@glemaitre glemaitre left a comment

Copy link
Copy Markdown
Member

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
@lesteve

lesteve commented Sep 4, 2024 •

Copy link
Copy Markdown
Member

🤔 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
Copy Markdown
Member

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

@lesteve

lesteve commented Sep 4, 2024 •

Copy link
Copy Markdown
Member

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

ogrisel commented Sep 4, 2024

Copy link
Copy Markdown
Member

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