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

Add MAPE as evaluation metric #10708

Closed
amueller opened this issue Feb 26, 2018 · 13 comments · Fixed by #15007
Closed

Add MAPE as evaluation metric #10708

amueller opened this issue Feb 26, 2018 · 13 comments · Fixed by #15007
Labels
Easy Well-defined and straightforward way to resolve Enhancement

Comments

@amueller
Copy link
Member

Also see #6605.

https://en.wikipedia.org/wiki/Mean_absolute_percentage_error

probably need a neg_mape scorer, too.

@amueller amueller added Easy Well-defined and straightforward way to resolve Enhancement help wanted labels Feb 26, 2018
@mohamed-ali
Copy link
Contributor

@amueller, I'd like to work on this.

@amueller
Copy link
Member Author

sure, go for it.

@mohamed-ali
Copy link
Contributor

@amueller, all sklearn metrics have an output in the[0,1] interval. Is it okay that this metric will have its output in [0,100]? or should we not multiply with 100 and only keep the fraction?

@amueller
Copy link
Member Author

@mohamed-ali not all. MSE doesn't, for example (though I guess all with a fixed range do). I think we should multiply by 100 given that it's part of the definition, even though it's slightly different from other metrics.

@mohamed-ali
Copy link
Contributor

@amueller okay great. Thanks for the quick reply :)

@mohamed-ali
Copy link
Contributor

@amueller regarding the scorer, based on the deprecation message in the following example, I assume there should be a neg_mean_absolute_percentage_error_scorer instead of mean_absolute_percentage_error_scorer:

neg_mean_squared_error_scorer = make_scorer(mean_squared_error,
                                            greater_is_better=False)
deprecation_msg = ('Scoring method mean_squared_error was renamed to '
                   'neg_mean_squared_error in version 0.18 and will '
                   'be removed in 0.20.')
mean_squared_error_scorer = make_scorer(mean_squared_error,
greater_is_better=False)

https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/metrics/scorer.py#L472-L497

Is my assumption correct?

@jnothman
Copy link
Member

jnothman commented Feb 26, 2018 via email

@jnothman
Copy link
Member

jnothman commented Feb 26, 2018 via email

@mohamed-ali
Copy link
Contributor

@amueller & @jnothman, I pushed the work in progress at this pull request #10711. We can move the discussion there and probably vote with the core devs on right name to consider.

@mohamed-ali
Copy link
Contributor

@amueller & @jnothman, the work is done in #10711. Could you please do a full review?

Thanks.

@mohamed-ali
Copy link
Contributor

@amueller @jnothman, out of curiosity, why do we prefix the scorer name with neg_?

@jnothman
Copy link
Member

jnothman commented Feb 28, 2018 via email

@mohamed-ali
Copy link
Contributor

@jnothman thank you!

@rth rth closed this as completed in #15007 Jul 4, 2020
rth added a commit that referenced this issue Jul 4, 2020
Co-authored-by: mohamed-ali <m.ali.jamaoui@gmail.com>
Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Joel Nothman <joel.nothman@gmail.com>
Co-authored-by: Roman Yurchak <rth.yurchak@pm.me>
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this issue Jul 17, 2020
 (scikit-learn#15007)

Co-authored-by: mohamed-ali <m.ali.jamaoui@gmail.com>
Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Joel Nothman <joel.nothman@gmail.com>
Co-authored-by: Roman Yurchak <rth.yurchak@pm.me>
jayzed82 pushed a commit to jayzed82/scikit-learn that referenced this issue Oct 22, 2020
 (scikit-learn#15007)

Co-authored-by: mohamed-ali <m.ali.jamaoui@gmail.com>
Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Joel Nothman <joel.nothman@gmail.com>
Co-authored-by: Roman Yurchak <rth.yurchak@pm.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy Well-defined and straightforward way to resolve Enhancement
Projects
None yet
3 participants