Skip to content

Commit

Permalink
Update formulas for metrics in documentation (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-a-bunin authored Jun 24, 2024
1 parent 57fdc16 commit bef697e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-
-
-
-
- Update formulas for metrics in documentation ([#406](https://github.com/etna-team/etna/pull/406))
-
- Update documentation to explain how to contribute and work with discussions, update templates for issues ([#395](https://github.com/etna-team/etna/pull/395))
- Remove "Other issue" template, update links to discussions in issue creation menu ([#401](https://github.com/etna-team/etna/pull/401))
Expand Down
4 changes: 2 additions & 2 deletions etna/metrics/intervals_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Coverage(Metric, _IntervalsMetricMixin):
"""Coverage metric for prediction intervals - precenteage of samples in the interval ``[lower quantile, upper quantile]``.
.. math::
Coverage(y\_true, y\_pred) = \\frac{\\sum_{i=0}^{n-1}{[ y\_true_i \\ge y\_pred_i^{lower\_quantile}] * [y\_true_i \\le y\_pred_i^{upper\_quantile}] }}{n}
Coverage(y\_true, y\_pred) = \\frac{\\sum_{i=1}^{n}{[ y\_true_i \\ge y\_pred_i^{lower\_quantile}] * [y\_true_i \\le y\_pred_i^{upper\_quantile}] }}{n}
Notes
-----
Expand Down Expand Up @@ -157,7 +157,7 @@ class Width(Metric, _IntervalsMetricMixin):
"""Mean width of prediction intervals.
.. math::
Width(y\_true, y\_pred) = \\frac{\\sum_{i=0}^{n-1}\\mid y\_pred_i^{upper\_quantile} - y\_pred_i^{lower\_quantile} \\mid}{n}
Width(y\_true, y\_pred) = \\frac{\\sum_{i=1}^{n}\\mid y\_pred_i^{upper\_quantile} - y\_pred_i^{lower\_quantile} \\mid}{n}
Notes
-----
Expand Down
20 changes: 10 additions & 10 deletions etna/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MAE(Metric):
"""Mean absolute error metric with multi-segment computation support.
.. math::
MAE(y\_true, y\_pred) = \\frac{\\sum_{i=0}^{n-1}{\\mid y\_true_i - y\_pred_i \\mid}}{n}
MAE(y\_true, y\_pred) = \\frac{\\sum_{i=1}^{n}{\\mid y\_true_i - y\_pred_i \\mid}}{n}
Notes
-----
Expand Down Expand Up @@ -49,7 +49,7 @@ class MSE(Metric):
"""Mean squared error metric with multi-segment computation support.
.. math::
MSE(y\_true, y\_pred) = \\frac{\\sum_{i=0}^{n-1}{(y\_true_i - y\_pred_i)^2}}{n}
MSE(y\_true, y\_pred) = \\frac{\\sum_{i=1}^{n}{(y\_true_i - y\_pred_i)^2}}{n}
Notes
-----
Expand Down Expand Up @@ -79,7 +79,7 @@ class RMSE(Metric):
"""Root mean squared error metric with multi-segment computation support.
.. math::
RMSE(y\_true, y\_pred) = \\sqrt\\frac{\\sum_{i=0}^{n-1}{(y\_true_i - y\_pred_i)^2}}{n}
RMSE(y\_true, y\_pred) = \\sqrt\\frac{\\sum_{i=1}^{n}{(y\_true_i - y\_pred_i)^2}}{n}
Notes
-----
Expand Down Expand Up @@ -109,7 +109,7 @@ class R2(Metric):
"""Coefficient of determination metric with multi-segment computation support.
.. math::
R^2(y\_true, y\_pred) = 1 - \\frac{\\sum_{i=0}^{n-1}{(y\_true_i - y\_pred_i)^2}}{\\sum_{i=0}^{n-1}{(y\_true_i - \\overline{y\_true})^2}}
R^2(y\_true, y\_pred) = 1 - \\frac{\\sum_{i=1}^{n}{(y\_true_i - y\_pred_i)^2}}{\\sum_{i=1}^{n}{(y\_true_i - \\overline{y\_true})^2}}
Notes
-----
You can read more about logic of multi-segment metrics in Metric docs.
Expand Down Expand Up @@ -138,7 +138,7 @@ class MAPE(Metric):
"""Mean absolute percentage error metric with multi-segment computation support.
.. math::
MAPE(y\_true, y\_pred) = \\frac{1}{n}\\cdot\\frac{\\sum_{i=0}^{n-1}{\\mid y\_true_i - y\_pred_i\\mid}}{\\mid y\_true_i \\mid + \epsilon}
MAPE(y\_true, y\_pred) = \\frac{1}{n} \\cdot \\sum_{i=1}^{n} \\frac{\\mid y\_true_i - y\_pred_i\\mid}{\\mid y\_true_i \\mid + \epsilon}
Notes
-----
Expand Down Expand Up @@ -168,7 +168,7 @@ class SMAPE(Metric):
"""Symmetric mean absolute percentage error metric with multi-segment computation support.
.. math::
SMAPE(y\_true, y\_pred) = \\frac{2 \\cdot 100 \\%}{n}\\cdot\\frac{\\sum_{i=0}^{n-1}{\\mid y\_true_i - y\_pred_i\\mid}}{\\mid y\_true_i \\mid + \\mid y\_pred_i \\mid}
SMAPE(y\_true, y\_pred) = \\frac{2 \\cdot 100 \\%}{n} \\cdot \\sum_{i=1}^{n} \\frac{\\mid y\_true_i - y\_pred_i\\mid}{\\mid y\_true_i \\mid + \\mid y\_pred_i \\mid}
Notes
-----
Expand Down Expand Up @@ -228,7 +228,7 @@ class MSLE(Metric):
"""Mean squared logarithmic error metric with multi-segment computation support.
.. math::
MSLE(y\_true, y\_pred) = \\frac{1}{n}\\cdot\\sum_{i=0}^{n - 1}{(ln(1 + y\_true_i) - ln(1 + y\_pred_i))^2}
MSLE(y\_true, y\_pred) = \\frac{1}{n}\\cdot\\sum_{i=1}^{n}{(ln(1 + y\_true_i) - ln(1 + y\_pred_i))^2}
Notes
-----
Expand Down Expand Up @@ -259,7 +259,7 @@ class Sign(Metric):
"""Sign error metric with multi-segment computation support.
.. math::
Sign(y\_true, y\_pred) = \\frac{1}{n}\\cdot\\sum_{i=0}^{n - 1}{sign(y\_true_i - y\_pred_i)}
Sign(y\_true, y\_pred) = \\frac{1}{n}\\cdot\\sum_{i=1}^{n}{sign(y\_true_i - y\_pred_i)}
Notes
-----
Expand Down Expand Up @@ -289,7 +289,7 @@ class MaxDeviation(Metric):
"""Max Deviation metric with multi-segment computation support (maximum deviation value of cumulative sums).
.. math::
MaxDeviation(y\_true, y\_pred) = \\max_{j} | y_j |, where \\, y_j = \\sum_{i=1}^{j}{y\_pred_i - y\_true_i}
MaxDeviation(y\_true, y\_pred) = \\max_{1 \\le j \\le n} | y_j |, where \\, y_j = \\sum_{i=1}^{j}{y\_pred_i - y\_true_i}
Notes
-----
Expand Down Expand Up @@ -319,7 +319,7 @@ class WAPE(Metric):
"""Weighted average percentage Error metric with multi-segment computation support.
.. math::
WAPE(y\_true, y\_pred) = \\frac{\\sum_{i=0}^{n} |y\_true_i - y\_pred_i|}{\\sum_{i=0}^{n}|y\\_true_i|}
WAPE(y\_true, y\_pred) = \\frac{\\sum_{i=1}^{n} |y\_true_i - y\_pred_i|}{\\sum_{i=1}^{n}|y\\_true_i|}
Notes
-----
You can read more about logic of multi-segment metrics in Metric docs.
Expand Down

0 comments on commit bef697e

Please sign in to comment.