6
6
"source" : [
7
7
" ## <span style=\" color:#ff5f27\" >👩🏻🔬 Feature Engineering </span>\n " ,
8
8
" \n " ,
9
+ " **Note**: This tutorial does not support Google Colab.\n " ,
10
+ " \n " ,
9
11
" **Your Python Jupyter notebook should be configured for >8GB of memory.**\n " ,
10
12
" \n " ,
11
13
" In this series of tutorials, we will build a recommender system for fashion items. It will consist of two models: a *retrieval model* and a *ranking model*. The idea is that the retrieval model should be able to quickly generate a small subset of candidate items from a large collection of items. This comes at the cost of granularity, which is why we also train a ranking model that can afford to use more features than the retrieval model.\n " ,
31
33
" ## <span style=\" color:#ff5f27\" >📝 Imports </span>"
32
34
]
33
35
},
34
- {
35
- "cell_type" : " code" ,
36
- "execution_count" : null ,
37
- "metadata" : {},
38
- "outputs" : [],
39
- "source" : [
40
- " # Hosted notebook environments may not have the local features package\n " ,
41
- " import os\n " ,
42
- " \n " ,
43
- " def need_download_modules():\n " ,
44
- " if 'google.colab' in str(get_ipython()):\n " ,
45
- " return True\n " ,
46
- " if 'HOPSWORKS_PROJECT_ID' in os.environ:\n " ,
47
- " return True\n " ,
48
- " return False\n " ,
49
- " \n " ,
50
- " if need_download_modules():\n " ,
51
- " print(\" ⚙️ Downloading modules...\" )\n " ,
52
- " os.system('mkdir -p features')\n " ,
53
- " os.system('cd features && wget https://raw.githubusercontent.com/logicalclocks/hopsworks-tutorials/master/advanced_tutorials/recommender-system/features/articles.py')\n " ,
54
- " os.system('cd features && wget https://raw.githubusercontent.com/logicalclocks/hopsworks-tutorials/master/advanced_tutorials/recommender-system/features/customers.py')\n " ,
55
- " os.system('cd features && wget https://raw.githubusercontent.com/logicalclocks/hopsworks-tutorials/master/advanced_tutorials/recommender-system/features/transactions.py')\n " ,
56
- " os.system('cd features && wget https://raw.githubusercontent.com/logicalclocks/hopsworks-tutorials/master/advanced_tutorials/recommender-system/features/ranking.py') \n " ,
57
- " print('✅ Done!')\n " ,
58
- " else:\n " ,
59
- " print(\" Local environment\" )"
60
- ]
61
- },
62
- {
63
- "cell_type" : " code" ,
64
- "execution_count" : null ,
65
- "metadata" : {},
66
- "outputs" : [],
67
- "source" : [
68
- " try:\n " ,
69
- " from features.articles import prepare_articles\n " ,
70
- " from features.customers import prepare_customers\n " ,
71
- " from features.transactions import prepare_transactions\n " ,
72
- " from features.ranking import compute_ranking_dataset\n " ,
73
- " except ImportError:\n " ,
74
- " print(\" ⚙️ Downloading modules...\" )\n " ,
75
- " os.system('mkdir -p features')\n " ,
76
- " os.system('cd features && wget https://raw.githubusercontent.com/logicalclocks/hopsworks-tutorials/master/advanced_tutorials/recommender-system/features/articles.py')\n " ,
77
- " os.system('cd features && wget https://raw.githubusercontent.com/logicalclocks/hopsworks-tutorials/master/advanced_tutorials/recommender-system/features/customers.py')\n " ,
78
- " os.system('cd features && wget https://raw.githubusercontent.com/logicalclocks/hopsworks-tutorials/master/advanced_tutorials/recommender-system/features/transactions.py')\n " ,
79
- " os.system('cd features && wget https://raw.githubusercontent.com/logicalclocks/hopsworks-tutorials/master/advanced_tutorials/recommender-system/features/ranking.py') \n " ,
80
- " print('✅ Done!')\n " ,
81
- " from features.articles import prepare_articles\n " ,
82
- " from features.customers import prepare_customers\n " ,
83
- " from features.transactions import prepare_transactions\n " ,
84
- " from features.ranking import compute_ranking_dataset "
85
- ]
86
- },
87
36
{
88
37
"cell_type" : " code" ,
89
38
"execution_count" : null ,
94
43
" import numpy as np\n " ,
95
44
" \n " ,
96
45
" import great_expectations as ge\n " ,
97
- " from great_expectations.core import ExpectationSuite, ExpectationConfiguration"
46
+ " from great_expectations.core import ExpectationSuite, ExpectationConfiguration\n " ,
47
+ " \n " ,
48
+ " from features.articles import prepare_articles\n " ,
49
+ " from features.customers import prepare_customers\n " ,
50
+ " from features.transactions import prepare_transactions\n " ,
51
+ " from features.ranking import compute_ranking_dataset "
98
52
]
99
53
},
100
54
{
613
567
"metadata" : {},
614
568
"outputs" : [],
615
569
"source" : [
616
- " ranking_df = compute_ranking_dataset(trans_fg, articles_fg, customers_fg)"
570
+ " ranking_df = compute_ranking_dataset(\n " ,
571
+ " trans_fg, \n " ,
572
+ " articles_fg, \n " ,
573
+ " customers_fg,\n " ,
574
+ " )"
617
575
]
618
576
},
619
577
{
687
645
"hash" : " 31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
688
646
},
689
647
"kernelspec" : {
690
- "display_name" : " Python" ,
648
+ "display_name" : " Python 3 (ipykernel) " ,
691
649
"language" : " python" ,
692
650
"name" : " python3"
693
651
},
701
659
"name" : " python" ,
702
660
"nbconvert_exporter" : " python" ,
703
661
"pygments_lexer" : " ipython3" ,
704
- "version" : " 3.10.11 "
662
+ "version" : " 3.9.18 "
705
663
}
706
664
},
707
665
"nbformat" : 4 ,
708
666
"nbformat_minor" : 4
709
- }
667
+ }
0 commit comments