diff --git a/notebooks/diagnostics.ipynb b/notebooks/diagnostics.ipynb
index ed1049b..28c6587 100644
--- a/notebooks/diagnostics.ipynb
+++ b/notebooks/diagnostics.ipynb
@@ -190,7 +190,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
- "model_id": "f5971fa216af4dbb971a6feaa145ccfd",
+ "model_id": "a27653066bb54f36a540ec95c975b083",
"version_major": 2,
"version_minor": 0
},
@@ -242,8 +242,8 @@
"
0 | \n",
" 2010-02-16 | \n",
" 8.957284 | \n",
- " 8.479379 | \n",
- " 9.442046 | \n",
+ " 8.471820 | \n",
+ " 9.464242 | \n",
" 8.242493 | \n",
" 2010-02-15 | \n",
" \n",
@@ -251,8 +251,8 @@
" 1 | \n",
" 2010-02-17 | \n",
" 8.723736 | \n",
- " 8.204953 | \n",
- " 9.200269 | \n",
+ " 8.215131 | \n",
+ " 9.236662 | \n",
" 8.008033 | \n",
" 2010-02-15 | \n",
" \n",
@@ -260,8 +260,8 @@
" 2 | \n",
" 2010-02-18 | \n",
" 8.607496 | \n",
- " 8.104760 | \n",
- " 9.091090 | \n",
+ " 8.059417 | \n",
+ " 9.089188 | \n",
" 8.045268 | \n",
" 2010-02-15 | \n",
" \n",
@@ -269,8 +269,8 @@
" 3 | \n",
" 2010-02-19 | \n",
" 8.529364 | \n",
- " 8.047678 | \n",
- " 9.030977 | \n",
+ " 8.019238 | \n",
+ " 9.034076 | \n",
" 7.928766 | \n",
" 2010-02-15 | \n",
" \n",
@@ -278,8 +278,8 @@
" 4 | \n",
" 2010-02-20 | \n",
" 8.271329 | \n",
- " 7.819674 | \n",
- " 8.768234 | \n",
+ " 7.779745 | \n",
+ " 8.760580 | \n",
" 7.745003 | \n",
" 2010-02-15 | \n",
" \n",
@@ -289,11 +289,11 @@
],
"text/plain": [
" ds yhat yhat_lower yhat_upper y cutoff\n",
- "0 2010-02-16 8.957284 8.479379 9.442046 8.242493 2010-02-15\n",
- "1 2010-02-17 8.723736 8.204953 9.200269 8.008033 2010-02-15\n",
- "2 2010-02-18 8.607496 8.104760 9.091090 8.045268 2010-02-15\n",
- "3 2010-02-19 8.529364 8.047678 9.030977 7.928766 2010-02-15\n",
- "4 2010-02-20 8.271329 7.819674 8.768234 7.745003 2010-02-15"
+ "0 2010-02-16 8.957284 8.471820 9.464242 8.242493 2010-02-15\n",
+ "1 2010-02-17 8.723736 8.215131 9.236662 8.008033 2010-02-15\n",
+ "2 2010-02-18 8.607496 8.059417 9.089188 8.045268 2010-02-15\n",
+ "3 2010-02-19 8.529364 8.019238 9.034076 7.928766 2010-02-15\n",
+ "4 2010-02-20 8.271329 7.779745 8.760580 7.745003 2010-02-15"
]
},
"execution_count": 3,
@@ -386,7 +386,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 3,
"metadata": {},
"outputs": [
{
@@ -415,6 +415,7 @@
" rmse | \n",
" mae | \n",
" mape | \n",
+ " mdape | \n",
" coverage | \n",
" \n",
" \n",
@@ -422,62 +423,67 @@
" \n",
" | 0 | \n",
" 37 days | \n",
- " 0.495378 | \n",
- " 0.703831 | \n",
- " 0.505713 | \n",
- " 0.058593 | \n",
- " 0.680448 | \n",
+ " 0.493403 | \n",
+ " 0.702427 | \n",
+ " 0.504660 | \n",
+ " 0.058481 | \n",
+ " 0.050009 | \n",
+ " 0.684102 | \n",
"
\n",
" \n",
" | 1 | \n",
" 38 days | \n",
- " 0.501134 | \n",
- " 0.707908 | \n",
- " 0.510680 | \n",
- " 0.059169 | \n",
- " 0.679077 | \n",
+ " 0.499306 | \n",
+ " 0.706616 | \n",
+ " 0.509672 | \n",
+ " 0.059061 | \n",
+ " 0.049334 | \n",
+ " 0.684102 | \n",
"
\n",
" \n",
" | 2 | \n",
" 39 days | \n",
- " 0.523334 | \n",
- " 0.723418 | \n",
- " 0.516755 | \n",
- " 0.059766 | \n",
- " 0.677707 | \n",
+ " 0.521533 | \n",
+ " 0.722172 | \n",
+ " 0.515789 | \n",
+ " 0.059662 | \n",
+ " 0.049502 | \n",
+ " 0.682732 | \n",
"
\n",
" \n",
" | 3 | \n",
" 40 days | \n",
- " 0.530625 | \n",
- " 0.728440 | \n",
- " 0.519645 | \n",
- " 0.060075 | \n",
- " 0.678849 | \n",
+ " 0.528744 | \n",
+ " 0.727148 | \n",
+ " 0.518585 | \n",
+ " 0.059961 | \n",
+ " 0.049254 | \n",
+ " 0.683874 | \n",
"
\n",
" \n",
" | 4 | \n",
" 41 days | \n",
- " 0.538117 | \n",
- " 0.733565 | \n",
- " 0.520663 | \n",
- " 0.060156 | \n",
- " 0.686386 | \n",
+ " 0.536127 | \n",
+ " 0.732207 | \n",
+ " 0.519498 | \n",
+ " 0.060030 | \n",
+ " 0.049334 | \n",
+ " 0.691412 | \n",
"
\n",
" \n",
"\n",
""
],
"text/plain": [
- " horizon mse rmse mae mape coverage\n",
- "0 37 days 0.495378 0.703831 0.505713 0.058593 0.680448\n",
- "1 38 days 0.501134 0.707908 0.510680 0.059169 0.679077\n",
- "2 39 days 0.523334 0.723418 0.516755 0.059766 0.677707\n",
- "3 40 days 0.530625 0.728440 0.519645 0.060075 0.678849\n",
- "4 41 days 0.538117 0.733565 0.520663 0.060156 0.686386"
+ " horizon mse rmse mae mape mdape coverage\n",
+ "0 37 days 0.493403 0.702427 0.504660 0.058481 0.050009 0.684102\n",
+ "1 38 days 0.499306 0.706616 0.509672 0.059061 0.049334 0.684102\n",
+ "2 39 days 0.521533 0.722172 0.515789 0.059662 0.049502 0.682732\n",
+ "3 40 days 0.528744 0.727148 0.518585 0.059961 0.049254 0.683874\n",
+ "4 41 days 0.536127 0.732207 0.519498 0.060030 0.049334 0.691412"
]
},
- "execution_count": 7,
+ "execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
diff --git a/python/fbprophet/diagnostics.py b/python/fbprophet/diagnostics.py
index 703b307..5ca3159 100644
--- a/python/fbprophet/diagnostics.py
+++ b/python/fbprophet/diagnostics.py
@@ -307,7 +307,8 @@ def performance_metrics(df, metrics=None, rolling_window=0.1):
'mse': mean squared error
'rmse': root mean squared error
'mae': mean absolute error
- 'mape': mean percent error
+ 'mape': mean absolute percent error
+ 'mdape': median absolute percent error
'coverage': coverage of the upper and lower intervals
A subset of these can be specified by passing a list of names as the
@@ -334,7 +335,7 @@ def performance_metrics(df, metrics=None, rolling_window=0.1):
----------
df: The dataframe returned by cross_validation.
metrics: A list of performance metrics to compute. If not provided, will
- use ['mse', 'rmse', 'mae', 'mape', 'coverage'].
+ use ['mse', 'rmse', 'mae', 'mape', 'mdape', 'coverage'].
rolling_window: Proportion of data to use in each rolling window for
computing the metrics. Should be in [0, 1] to average