Skip to content

Commit

Permalink
docs: update formatting in 02_advanced
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff committed Dec 8, 2022
1 parent f2648f8 commit 47065e9
Showing 1 changed file with 33 additions and 19 deletions.
52 changes: 33 additions & 19 deletions tutorials/02_advanced.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,39 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from timeseriesflattener.feature_spec_objects import PredictorGroupSpec\n",
"\n",
"# Import synth_predictor_binary to populate the data_loaders registry with the function\n",
"from timeseriesflattener.testing.load_synth_data import synth_predictor_binary\n",
"from pprint import pprint\n",
"from timeseriesflattener.resolve_multiple_functions import maximum\n",
"\n",
"pred_spec_batch = PredictorGroupSpec(\n",
" values_loader=[\"synth_predictor_float\"],\n",
" lookbehind_days=[365, 730],\n",
" fallback=[np.nan],\n",
" resolve_multiple_fn=[mean, maximum],\n",
").create_combinations()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You'll note that:\n",
"1. All attributes are now required to be lists. This makes iteration easier when creating the combinations.\n",
"2. We require values_loaders to be strings that can be resolved in the registries. This string is used when creating the column names - otherwise we wouldn't know what to call the columns.\n",
"\n",
"Let's check that the results look good."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -356,20 +388,6 @@
}
],
"source": [
"from timeseriesflattener.feature_spec_objects import PredictorGroupSpec\n",
"\n",
"# Import synth_predictor_binary to populate the data_loaders registry with the function\n",
"from timeseriesflattener.testing.load_synth_data import synth_predictor_binary\n",
"from pprint import pprint\n",
"from timeseriesflattener.resolve_multiple_functions import maximum\n",
"\n",
"pred_spec_batch = PredictorGroupSpec(\n",
" values_loader=[\"synth_predictor_float\"],\n",
" lookbehind_days=[365, 730],\n",
" fallback=[np.nan],\n",
" resolve_multiple_fn=[mean, maximum],\n",
").create_combinations()\n",
"\n",
"# Create a small summary to highlight the generated predictors\n",
"pred_spec_batch_summary = [\n",
" {\n",
Expand All @@ -389,10 +407,6 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"You'll note that:\n",
"1. All attributes are now required to be lists. This makes iteration easier when creating the combinations.\n",
"2. We require values_loaders to be strings that can be resolved in the registries. This string is used when creating the column names - otherwise we wouldn't know what to call the columns.\n",
"\n",
"Now we know how to create a bunch of feature specifications quickly! But with more features comes more computation. Let's look at caching next, so we can iterate on our datasets more quickly."
]
},
Expand Down

0 comments on commit 47065e9

Please sign in to comment.