mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-18 08:53:42 +00:00
Include mdape in performance metric docstring (#1512)
* update docstring with mdape in list for python perf metric func * re-run python notebook cell to generate mdape in results table * remove comment Co-authored-by: Ben Letham <bletham@gmail.com>
This commit is contained in:
parent
31841c90c9
commit
30bcfed918
2 changed files with 58 additions and 51 deletions
|
|
@ -190,7 +190,7 @@
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"application/vnd.jupyter.widget-view+json": {
|
"application/vnd.jupyter.widget-view+json": {
|
||||||
"model_id": "f5971fa216af4dbb971a6feaa145ccfd",
|
"model_id": "a27653066bb54f36a540ec95c975b083",
|
||||||
"version_major": 2,
|
"version_major": 2,
|
||||||
"version_minor": 0
|
"version_minor": 0
|
||||||
},
|
},
|
||||||
|
|
@ -242,8 +242,8 @@
|
||||||
" <th>0</th>\n",
|
" <th>0</th>\n",
|
||||||
" <td>2010-02-16</td>\n",
|
" <td>2010-02-16</td>\n",
|
||||||
" <td>8.957284</td>\n",
|
" <td>8.957284</td>\n",
|
||||||
" <td>8.479379</td>\n",
|
" <td>8.471820</td>\n",
|
||||||
" <td>9.442046</td>\n",
|
" <td>9.464242</td>\n",
|
||||||
" <td>8.242493</td>\n",
|
" <td>8.242493</td>\n",
|
||||||
" <td>2010-02-15</td>\n",
|
" <td>2010-02-15</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
|
|
@ -251,8 +251,8 @@
|
||||||
" <th>1</th>\n",
|
" <th>1</th>\n",
|
||||||
" <td>2010-02-17</td>\n",
|
" <td>2010-02-17</td>\n",
|
||||||
" <td>8.723736</td>\n",
|
" <td>8.723736</td>\n",
|
||||||
" <td>8.204953</td>\n",
|
" <td>8.215131</td>\n",
|
||||||
" <td>9.200269</td>\n",
|
" <td>9.236662</td>\n",
|
||||||
" <td>8.008033</td>\n",
|
" <td>8.008033</td>\n",
|
||||||
" <td>2010-02-15</td>\n",
|
" <td>2010-02-15</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
|
|
@ -260,8 +260,8 @@
|
||||||
" <th>2</th>\n",
|
" <th>2</th>\n",
|
||||||
" <td>2010-02-18</td>\n",
|
" <td>2010-02-18</td>\n",
|
||||||
" <td>8.607496</td>\n",
|
" <td>8.607496</td>\n",
|
||||||
" <td>8.104760</td>\n",
|
" <td>8.059417</td>\n",
|
||||||
" <td>9.091090</td>\n",
|
" <td>9.089188</td>\n",
|
||||||
" <td>8.045268</td>\n",
|
" <td>8.045268</td>\n",
|
||||||
" <td>2010-02-15</td>\n",
|
" <td>2010-02-15</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
|
|
@ -269,8 +269,8 @@
|
||||||
" <th>3</th>\n",
|
" <th>3</th>\n",
|
||||||
" <td>2010-02-19</td>\n",
|
" <td>2010-02-19</td>\n",
|
||||||
" <td>8.529364</td>\n",
|
" <td>8.529364</td>\n",
|
||||||
" <td>8.047678</td>\n",
|
" <td>8.019238</td>\n",
|
||||||
" <td>9.030977</td>\n",
|
" <td>9.034076</td>\n",
|
||||||
" <td>7.928766</td>\n",
|
" <td>7.928766</td>\n",
|
||||||
" <td>2010-02-15</td>\n",
|
" <td>2010-02-15</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
|
|
@ -278,8 +278,8 @@
|
||||||
" <th>4</th>\n",
|
" <th>4</th>\n",
|
||||||
" <td>2010-02-20</td>\n",
|
" <td>2010-02-20</td>\n",
|
||||||
" <td>8.271329</td>\n",
|
" <td>8.271329</td>\n",
|
||||||
" <td>7.819674</td>\n",
|
" <td>7.779745</td>\n",
|
||||||
" <td>8.768234</td>\n",
|
" <td>8.760580</td>\n",
|
||||||
" <td>7.745003</td>\n",
|
" <td>7.745003</td>\n",
|
||||||
" <td>2010-02-15</td>\n",
|
" <td>2010-02-15</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
|
|
@ -289,11 +289,11 @@
|
||||||
],
|
],
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
" ds yhat yhat_lower yhat_upper y cutoff\n",
|
" 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",
|
"0 2010-02-16 8.957284 8.471820 9.464242 8.242493 2010-02-15\n",
|
||||||
"1 2010-02-17 8.723736 8.204953 9.200269 8.008033 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.104760 9.091090 8.045268 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.047678 9.030977 7.928766 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.819674 8.768234 7.745003 2010-02-15"
|
"4 2010-02-20 8.271329 7.779745 8.760580 7.745003 2010-02-15"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 3,
|
"execution_count": 3,
|
||||||
|
|
@ -386,7 +386,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 7,
|
"execution_count": 3,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
|
|
@ -415,6 +415,7 @@
|
||||||
" <th>rmse</th>\n",
|
" <th>rmse</th>\n",
|
||||||
" <th>mae</th>\n",
|
" <th>mae</th>\n",
|
||||||
" <th>mape</th>\n",
|
" <th>mape</th>\n",
|
||||||
|
" <th>mdape</th>\n",
|
||||||
" <th>coverage</th>\n",
|
" <th>coverage</th>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
" </thead>\n",
|
" </thead>\n",
|
||||||
|
|
@ -422,62 +423,67 @@
|
||||||
" <tr>\n",
|
" <tr>\n",
|
||||||
" <th>0</th>\n",
|
" <th>0</th>\n",
|
||||||
" <td>37 days</td>\n",
|
" <td>37 days</td>\n",
|
||||||
" <td>0.495378</td>\n",
|
" <td>0.493403</td>\n",
|
||||||
" <td>0.703831</td>\n",
|
" <td>0.702427</td>\n",
|
||||||
" <td>0.505713</td>\n",
|
" <td>0.504660</td>\n",
|
||||||
" <td>0.058593</td>\n",
|
" <td>0.058481</td>\n",
|
||||||
" <td>0.680448</td>\n",
|
" <td>0.050009</td>\n",
|
||||||
|
" <td>0.684102</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
" <tr>\n",
|
" <tr>\n",
|
||||||
" <th>1</th>\n",
|
" <th>1</th>\n",
|
||||||
" <td>38 days</td>\n",
|
" <td>38 days</td>\n",
|
||||||
" <td>0.501134</td>\n",
|
" <td>0.499306</td>\n",
|
||||||
" <td>0.707908</td>\n",
|
" <td>0.706616</td>\n",
|
||||||
" <td>0.510680</td>\n",
|
" <td>0.509672</td>\n",
|
||||||
" <td>0.059169</td>\n",
|
" <td>0.059061</td>\n",
|
||||||
" <td>0.679077</td>\n",
|
" <td>0.049334</td>\n",
|
||||||
|
" <td>0.684102</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
" <tr>\n",
|
" <tr>\n",
|
||||||
" <th>2</th>\n",
|
" <th>2</th>\n",
|
||||||
" <td>39 days</td>\n",
|
" <td>39 days</td>\n",
|
||||||
" <td>0.523334</td>\n",
|
" <td>0.521533</td>\n",
|
||||||
" <td>0.723418</td>\n",
|
" <td>0.722172</td>\n",
|
||||||
" <td>0.516755</td>\n",
|
" <td>0.515789</td>\n",
|
||||||
" <td>0.059766</td>\n",
|
" <td>0.059662</td>\n",
|
||||||
" <td>0.677707</td>\n",
|
" <td>0.049502</td>\n",
|
||||||
|
" <td>0.682732</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
" <tr>\n",
|
" <tr>\n",
|
||||||
" <th>3</th>\n",
|
" <th>3</th>\n",
|
||||||
" <td>40 days</td>\n",
|
" <td>40 days</td>\n",
|
||||||
" <td>0.530625</td>\n",
|
" <td>0.528744</td>\n",
|
||||||
" <td>0.728440</td>\n",
|
" <td>0.727148</td>\n",
|
||||||
" <td>0.519645</td>\n",
|
" <td>0.518585</td>\n",
|
||||||
" <td>0.060075</td>\n",
|
" <td>0.059961</td>\n",
|
||||||
" <td>0.678849</td>\n",
|
" <td>0.049254</td>\n",
|
||||||
|
" <td>0.683874</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
" <tr>\n",
|
" <tr>\n",
|
||||||
" <th>4</th>\n",
|
" <th>4</th>\n",
|
||||||
" <td>41 days</td>\n",
|
" <td>41 days</td>\n",
|
||||||
" <td>0.538117</td>\n",
|
" <td>0.536127</td>\n",
|
||||||
" <td>0.733565</td>\n",
|
" <td>0.732207</td>\n",
|
||||||
" <td>0.520663</td>\n",
|
" <td>0.519498</td>\n",
|
||||||
" <td>0.060156</td>\n",
|
" <td>0.060030</td>\n",
|
||||||
" <td>0.686386</td>\n",
|
" <td>0.049334</td>\n",
|
||||||
|
" <td>0.691412</td>\n",
|
||||||
" </tr>\n",
|
" </tr>\n",
|
||||||
" </tbody>\n",
|
" </tbody>\n",
|
||||||
"</table>\n",
|
"</table>\n",
|
||||||
"</div>"
|
"</div>"
|
||||||
],
|
],
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
" horizon mse rmse mae mape coverage\n",
|
" horizon mse rmse mae mape mdape coverage\n",
|
||||||
"0 37 days 0.495378 0.703831 0.505713 0.058593 0.680448\n",
|
"0 37 days 0.493403 0.702427 0.504660 0.058481 0.050009 0.684102\n",
|
||||||
"1 38 days 0.501134 0.707908 0.510680 0.059169 0.679077\n",
|
"1 38 days 0.499306 0.706616 0.509672 0.059061 0.049334 0.684102\n",
|
||||||
"2 39 days 0.523334 0.723418 0.516755 0.059766 0.677707\n",
|
"2 39 days 0.521533 0.722172 0.515789 0.059662 0.049502 0.682732\n",
|
||||||
"3 40 days 0.530625 0.728440 0.519645 0.060075 0.678849\n",
|
"3 40 days 0.528744 0.727148 0.518585 0.059961 0.049254 0.683874\n",
|
||||||
"4 41 days 0.538117 0.733565 0.520663 0.060156 0.686386"
|
"4 41 days 0.536127 0.732207 0.519498 0.060030 0.049334 0.691412"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 7,
|
"execution_count": 3,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,8 @@ def performance_metrics(df, metrics=None, rolling_window=0.1):
|
||||||
'mse': mean squared error
|
'mse': mean squared error
|
||||||
'rmse': root mean squared error
|
'rmse': root mean squared error
|
||||||
'mae': mean absolute 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
|
'coverage': coverage of the upper and lower intervals
|
||||||
|
|
||||||
A subset of these can be specified by passing a list of names as the
|
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.
|
df: The dataframe returned by cross_validation.
|
||||||
metrics: A list of performance metrics to compute. If not provided, will
|
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
|
rolling_window: Proportion of data to use in each rolling window for
|
||||||
computing the metrics. Should be in [0, 1] to average
|
computing the metrics. Should be in [0, 1] to average
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue