Skip to content

Commit

Permalink
Merge pull request #83 from uber/bt_enhance
Browse files Browse the repository at this point in the history
Bt enhance
  • Loading branch information
wangzhishi committed Apr 15, 2020
2 parents c776fe6 + 77d83c6 commit 693746f
Show file tree
Hide file tree
Showing 6 changed files with 523 additions and 131 deletions.
435 changes: 379 additions & 56 deletions examples/Backtest_Orbit_Model.ipynb

Large diffs are not rendered by default.

99 changes: 69 additions & 30 deletions examples/Regressors_setup_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-26T06:36:53.430179Z",
Expand All @@ -41,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-26T06:36:53.434780Z",
Expand All @@ -60,7 +60,7 @@
"dtype: object"
]
},
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -75,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-26T06:36:53.483821Z",
Expand Down Expand Up @@ -165,7 +165,7 @@
"4 2010-01-31 538617 1.086926 0.776993 1.072525"
]
},
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -176,7 +176,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-26T06:36:53.490218Z",
Expand Down Expand Up @@ -207,7 +207,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -218,7 +218,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -230,13 +230,15 @@
" seasonality=52,\n",
" seed=1,\n",
" predict_method='map',\n",
" is_multiplicative=True\n",
" sample_method='map',\n",
" is_multiplicative=True,\n",
" auto_scale=False\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-26T06:36:53.916107Z",
Expand All @@ -258,43 +260,80 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>regressor</th>\n",
" <th>regressor_sign</th>\n",
" <th>coefficient</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>trend.unemploy</td>\n",
" <td>Positive</td>\n",
" <td>0.041533</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>trend.filling</td>\n",
" <td>Positive</td>\n",
" <td>0.000011</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>trend.job</td>\n",
" <td>Regular</td>\n",
" <td>-0.070758</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"array([[4.15329225e-02, 1.12462424e-05]])"
" regressor regressor_sign coefficient\n",
"0 trend.unemploy Positive 0.041533\n",
"1 trend.filling Positive 0.000011\n",
"2 trend.job Regular -0.070758"
]
},
"execution_count": 9,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lgt_map.aggregated_posteriors['map']['pr_beta']"
"lgt_map.get_regression_coefs(aggregation_method='map')"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([-0.07075831])"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lgt_map.aggregated_posteriors['map']['rr_beta']"
]
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
Expand Down
Loading

0 comments on commit 693746f

Please sign in to comment.