Skip to content

Commit

Permalink
[FSTORE-1083] Add streamlit to recsys tutorial, GE and feature decsri…
Browse files Browse the repository at this point in the history
…btions, move feature views and add docstr to feature functions (#214)

[FSTORE-1083] Add streamlit to recsys tutorial, GE and feature decsribtions, move feature views and add docstr to feature functions
  • Loading branch information
Maxxx-zh authored Nov 18, 2023
1 parent 3465ce2 commit 0bdbd60
Show file tree
Hide file tree
Showing 12 changed files with 680 additions and 239 deletions.
336 changes: 253 additions & 83 deletions advanced_tutorials/recommender-system/1_feature_engineering.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"metadata": {},
"outputs": [],
"source": [
"train_df, val_df, test_df, y_train, y_val, y_test = feature_view.train_validation_test_split(\n",
"train_df, val_df, test_df, _, _, _ = feature_view.train_validation_test_split(\n",
" validation_size=0.1, \n",
" test_size=0.1,\n",
" description='Retrieval dataset splits',\n",
Expand Down Expand Up @@ -676,7 +676,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python",
"language": "python",
"name": "python3"
},
Expand All @@ -690,9 +690,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}
15 changes: 4 additions & 11 deletions advanced_tutorials/recommender-system/3_build_index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"metadata": {},
"outputs": [],
"source": [
"train_df, val_df, test_df, y_train, y_val, y_test = feature_view.train_validation_test_split(\n",
"train_df, val_df, test_df, _, _, _ = feature_view.train_validation_test_split(\n",
" validation_size=0.1, \n",
" test_size=0.1,\n",
" description='Retrieval dataset splits',\n",
Expand Down Expand Up @@ -343,21 +343,14 @@
"\n",
"At this point we have a recommender system that is able to generate a set of candidate items for a customer. However, many of these could be poor, as the candidate model was trained with only a few subset of the features. In the next notebook, we'll create a ranking dataset to train a *ranking model* to do more fine-grained predictions."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python",
"language": "python",
"name": "python3"
},
Expand All @@ -371,9 +364,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}
86 changes: 81 additions & 5 deletions advanced_tutorials/recommender-system/4_train_ranking_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,84 @@
"metadata": {},
"outputs": [],
"source": [
"feature_view_ranking = fs.get_feature_view(\n",
"customers_fg = fs.get_feature_group(\n",
" name=\"customers\",\n",
" version=1,\n",
")\n",
"\n",
"articles_fg = fs.get_feature_group(\n",
" name=\"articles\",\n",
" version=1,\n",
")\n",
"\n",
"trans_fg = fs.get_feature_group(\n",
" name=\"transactions\",\n",
" version=1,\n",
")\n",
"\n",
"rank_fg = fs.get_feature_group(\n",
" name=\"ranking\",\n",
" version=1,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## <span style=\"color:#ff5f27\">⚙️ Feature View Creation </span>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"customers_query = customers_fg.select_all()\n",
"fs.get_or_create_feature_view( \n",
" name='customers',\n",
" query=customers_query,\n",
" version=1,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"articles_query = articles_fg.select_all()\n",
"fs.get_or_create_feature_view(\n",
" name='articles',\n",
" query=articles_query,\n",
" version=1,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"rank_fg = fs.get_or_create_feature_group(\n",
" name=\"ranking\",\n",
" version=1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ranking_query = rank_fg.select_except([\"customer_id\", \"article_id\"])\n",
"feature_view_ranking = fs.get_or_create_feature_view(\n",
" name='ranking',\n",
" query=ranking_query,\n",
" labels = [\"label\"],\n",
" version=1,\n",
")"
]
Expand All @@ -64,7 +140,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## <span style=\"color:#ff5f27\">🗄️ Data loading </span>"
"## <span style=\"color:#ff5f27\">🗄️ Train Data loading </span>"
]
},
{
Expand Down Expand Up @@ -255,7 +331,7 @@
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python",
"language": "python",
"name": "python3"
},
Expand All @@ -269,9 +345,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python",
"language": "python",
"name": "python3"
},
Expand All @@ -572,9 +572,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
}
108 changes: 0 additions & 108 deletions advanced_tutorials/recommender-system/6_inference_and_ui.ipynb

This file was deleted.

Loading

0 comments on commit 0bdbd60

Please sign in to comment.