-
Notifications
You must be signed in to change notification settings - Fork 86
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 MASE metric #1166
Add MASE metric #1166
Conversation
valer1435
commented
Sep 7, 2023
- MASE metric for time series forecasting task was implemented https://en.wikipedia.org/wiki/Mean_absolute_scaled_error
- TimeSeriesForecastingMetricsEnum was created
Может по умолчанию для Федота ее поставить? |
@@ -53,6 +53,18 @@ class RegressionMetricsEnum(QualityMetricsEnum): | |||
RMSE_penalty = 'rmse_pen' | |||
|
|||
|
|||
class TimeSeriesForecastingMetricsEnum(QualityMetricsEnum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А нельзя его унаследовать от RegressionMetricsEnum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нет. Он требует тренировочную выборку, тк на ней считает ошибку наивного предсказания
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А насколько критично использовать тренировочную выборку? Как будто бы средняя ошибка наивного предсказания не должна кардинально меняться при переходе от тренировочной к тестовой выборке.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нет. Он требует тренировочную выборку, тк на ней считает ошибку наивного предсказания
Но вроде это enum, он ничего не требует...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нет. Он требует тренировочную выборку, тк на ней считает ошибку наивного предсказания
Но вроде это enum, он ничего не требует...
Имею ввиду, что метрика для расчета требует значения ряда на тренировочной выборке, поэтому для регрессии метрика не подходит. Получается, что метрика находится в enum'e регрессии, но вызвать для регрессии мы ее не можем (федот либо упадет, либо переварит, в случае одномерного data.features, но какого-то смысла это иметь не будет)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А насколько критично использовать тренировочную выборку? Как будто бы средняя ошибка наивного предсказания не должна кардинально меняться при переходе от тренировочной к тестовой выборке.
Как я понял, на большом промежутке (тренировочной выборки) мы получим больше информации об изменчивости ряда. Еще одна причина - при горизонте=1, если новое значение равно предыдущему - метрика будет не определена (аналогично, если все новые значения просто равны последнему известному)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Получается, что метрика находится в enum'e регрессии, но вызвать для регрессии мы ее не можем
Это так. Я предлагаю унаследовать TimeSeriesForecastingMetricsEnum от RegressionMetricsEnum, добавив туда одну метрику. И не дублируя остальных универсальных.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Получается, что метрика находится в enum'e регрессии, но вызвать для регрессии мы ее не можем
Это так. Я предлагаю унаследовать TimeSeriesForecastingMetricsEnum от RegressionMetricsEnum, добавив туда одну метрику. И не дублируя остальных универсальных.
https://docs.python.org/3/howto/enum.html#restricted-enum-subclassing - нельзя так, к сожалению
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
requirements.txt
Outdated
@@ -14,6 +14,7 @@ statsmodels>=0.12.0 | |||
ete3>=3.1.0 | |||
networkx>=2.4, !=2.7.*, !=2.8.1, !=2.8.2, !=2.8.3 | |||
scikit_learn>=1.0.0; python_version >= '3.8' | |||
sktime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Версия?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicl-nno А имеет смысл реализовать расчет метрики с помощью numpy? Чтобы не тянуть стороннюю библиотеку из-за однострочной формулы.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да наверное где-то ещё пригодится для работы с временными рядами. Если поймем что нет - тогда уж упростим.
Codecov Report
@@ Coverage Diff @@
## master #1166 +/- ##
==========================================
+ Coverage 79.77% 79.78% +0.01%
==========================================
Files 142 142
Lines 9863 9880 +17
==========================================
+ Hits 7868 7883 +15
- Misses 1995 1997 +2
|
Hello @valer1435! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2023-09-14 08:07:00 UTC |
311cb24
to
3f4f4ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно еще в api одновить docstring для metric
* Remove redundant metrics mapping * Convert str to MetricsEnum * Refactor MetricsObjective * Remove ApiMetrics * Fix test prediction intervals * Fix tests * PEP 8 * Fix paths * Move to init * зуз8 * Add MASE metric (#1166) MASE metric for time series forecasting task was implemented https://en.wikipedia.org/wiki/Mean_absolute_scaled_error TimeSeriesForecastingMetricsEnum was created * Review fixes * Remove redundant metrics mapping * Convert str to MetricsEnum * Refactor MetricsObjective * Remove ApiMetrics * Fix test prediction intervals * Fix tests * PEP 8 * Fix paths * Move to init * зуз8 * Review fixes * Convert str to MetricsEnum * Refactor MetricsObjective --------- Co-authored-by: Valerii Pokrovskii <[email protected]>