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

[DOC] correct docstring of BaseForecaster.score, reference to use of non-symmetric MAPE #4948

Merged
merged 4 commits into from Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Expand Up @@ -282,6 +282,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="11.11%"><a href="https://github.com/vincent-nich12"><img src="https://avatars3.githubusercontent.com/u/36476633?v=4?s=100" width="100px;" alt="vincent-nich12"/><br /><sub><b>vincent-nich12</b></sub></a><br /><a href="https://github.com/sktime/sktime/commits?author=vincent-nich12" title="Code">💻</a></td>
<td align="center" valign="top" width="11.11%"><a href="https://github.com/vollmersj"><img src="https://avatars2.githubusercontent.com/u/12613127?v=4?s=100" width="100px;" alt="vollmersj"/><br /><sub><b>vollmersj</b></sub></a><br /><a href="https://github.com/sktime/sktime/commits?author=vollmersj" title="Documentation">📖</a></td>
<td align="center" valign="top" width="11.11%"><a href="https://github.com/xiaobenbenecho"><img src="https://avatars.githubusercontent.com/u/17461849?v=4?s=100" width="100px;" alt="xiaobenbenecho"/><br /><sub><b>xiaobenbenecho</b></sub></a><br /><a href="https://github.com/sktime/sktime/commits?author=xiaobenbenecho" title="Code">💻</a></td>
<td align="center" valign="top" width="11.11%"><a href="https://github.com/MBristle"><img src="https://avatars.githubusercontent.com/u/12894818?v=4?s=100" width="100px;" alt="MBristle"/><br /><sub><b>MBristle</b></sub></a><br /><a href="https://github.com/sktime/sktime/commits?author=MBristle" title="Documentation">📖</a></td>
</tr>
</tbody>
</table>
Expand Down
12 changes: 8 additions & 4 deletions sktime/forecasting/base/_base.py
Expand Up @@ -1232,7 +1232,7 @@ def predict_residuals(self, y=None, X=None):
return y_res

def score(self, y, X=None, fh=None):
"""Scores forecast against ground truth, using MAPE.
"""Scores forecast against ground truth, using MAPE (non-symmetric).

Parameters
----------
Expand All @@ -1252,20 +1252,24 @@ def score(self, y, X=None, fh=None):
Returns
-------
score : float
sMAPE loss of self.predict(fh, X) with respect to y_test.
MAPE loss of self.predict(fh, X) with respect to y_test.

See Also
--------
:meth:`sktime.performance_metrics.forecasting.mean_absolute_percentage_error`
"""
# no input checks needed here, they will be performed
# in predict and loss function
# symmetric=True is default for mean_absolute_percentage_error
from sktime.performance_metrics.forecasting import (
mean_absolute_percentage_error,
)

return mean_absolute_percentage_error(y, self.predict(fh, X))
# specify non-symmetric explicit as it changed in the past
return mean_absolute_percentage_error(
y,
self.predict(fh, X),
symmetric=False
)

def get_fitted_params(self, deep=True):
"""Get fitted parameters.
Expand Down