Skip to content

Commit a44ff91

Browse files
committed
🚀 Update notebooks to 0.1.2
1 parent ab70f0e commit a44ff91

File tree

4 files changed

+111
-101
lines changed

4 files changed

+111
-101
lines changed

notebooks/RetailHero.ipynb

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107
"execution_count": 1,
108108
"metadata": {
109109
"ExecuteTime": {
110-
"end_time": "2020-04-28T09:24:37.492036Z",
111-
"start_time": "2020-04-28T09:24:37.488584Z"
110+
"end_time": "2020-05-02T17:07:22.372375Z",
111+
"start_time": "2020-05-02T17:07:22.368436Z"
112112
},
113113
"colab": {
114114
"base_uri": "https://localhost:8080/",
@@ -126,7 +126,7 @@
126126
"urllib.request.urlretrieve(url, '/content/retail_hero.zip')\n",
127127
"\n",
128128
"!unzip /content/retail_hero.zip\n",
129-
"!pip install scikit-uplift==0.1.1 catboost=0.22"
129+
"!pip install scikit-uplift==0.1.2 catboost=0.22"
130130
]
131131
},
132132
{
@@ -144,8 +144,8 @@
144144
"execution_count": 2,
145145
"metadata": {
146146
"ExecuteTime": {
147-
"end_time": "2020-04-28T09:24:40.783897Z",
148-
"start_time": "2020-04-28T09:24:37.503470Z"
147+
"end_time": "2020-05-02T17:07:25.384054Z",
148+
"start_time": "2020-05-02T17:07:22.383222Z"
149149
},
150150
"colab": {},
151151
"colab_type": "code",
@@ -196,8 +196,8 @@
196196
"execution_count": 3,
197197
"metadata": {
198198
"ExecuteTime": {
199-
"end_time": "2020-04-28T09:24:42.100096Z",
200-
"start_time": "2020-04-28T09:24:40.786498Z"
199+
"end_time": "2020-05-02T17:07:26.483716Z",
200+
"start_time": "2020-05-02T17:07:25.386480Z"
201201
},
202202
"colab": {},
203203
"colab_type": "code",
@@ -251,8 +251,8 @@
251251
"execution_count": 4,
252252
"metadata": {
253253
"ExecuteTime": {
254-
"end_time": "2020-04-28T09:24:44.483576Z",
255-
"start_time": "2020-04-28T09:24:42.102707Z"
254+
"end_time": "2020-05-02T17:07:28.491581Z",
255+
"start_time": "2020-05-02T17:07:26.486312Z"
256256
},
257257
"colab": {
258258
"base_uri": "https://localhost:8080/",
@@ -313,8 +313,8 @@
313313
"execution_count": 5,
314314
"metadata": {
315315
"ExecuteTime": {
316-
"end_time": "2020-04-28T09:24:44.511016Z",
317-
"start_time": "2020-04-28T09:24:44.486035Z"
316+
"end_time": "2020-05-02T17:07:28.514717Z",
317+
"start_time": "2020-05-02T17:07:28.494500Z"
318318
},
319319
"colab": {
320320
"base_uri": "https://localhost:8080/",
@@ -484,8 +484,8 @@
484484
"execution_count": 6,
485485
"metadata": {
486486
"ExecuteTime": {
487-
"end_time": "2020-04-28T09:24:45.715602Z",
488-
"start_time": "2020-04-28T09:24:44.514353Z"
487+
"end_time": "2020-05-02T17:07:29.570605Z",
488+
"start_time": "2020-05-02T17:07:28.518362Z"
489489
},
490490
"colab": {
491491
"base_uri": "https://localhost:8080/",
@@ -545,8 +545,8 @@
545545
"execution_count": 7,
546546
"metadata": {
547547
"ExecuteTime": {
548-
"end_time": "2020-04-28T09:24:47.941480Z",
549-
"start_time": "2020-04-28T09:24:45.719641Z"
548+
"end_time": "2020-05-02T17:07:31.489869Z",
549+
"start_time": "2020-05-02T17:07:29.572733Z"
550550
},
551551
"colab": {
552552
"base_uri": "https://localhost:8080/",
@@ -632,8 +632,8 @@
632632
"execution_count": 8,
633633
"metadata": {
634634
"ExecuteTime": {
635-
"end_time": "2020-04-28T09:24:50.571779Z",
636-
"start_time": "2020-04-28T09:24:47.944822Z"
635+
"end_time": "2020-05-02T17:07:33.865281Z",
636+
"start_time": "2020-05-02T17:07:31.494251Z"
637637
},
638638
"colab": {
639639
"base_uri": "https://localhost:8080/",
@@ -694,8 +694,8 @@
694694
"execution_count": 9,
695695
"metadata": {
696696
"ExecuteTime": {
697-
"end_time": "2020-04-28T09:24:52.942803Z",
698-
"start_time": "2020-04-28T09:24:50.576741Z"
697+
"end_time": "2020-05-02T17:07:36.709646Z",
698+
"start_time": "2020-05-02T17:07:33.871512Z"
699699
},
700700
"colab": {
701701
"base_uri": "https://localhost:8080/",
@@ -758,8 +758,8 @@
758758
"execution_count": 10,
759759
"metadata": {
760760
"ExecuteTime": {
761-
"end_time": "2020-04-28T09:24:52.964396Z",
762-
"start_time": "2020-04-28T09:24:52.945544Z"
761+
"end_time": "2020-05-02T17:07:36.726223Z",
762+
"start_time": "2020-05-02T17:07:36.712564Z"
763763
},
764764
"colab": {
765765
"base_uri": "https://localhost:8080/",
@@ -858,8 +858,8 @@
858858
"execution_count": 11,
859859
"metadata": {
860860
"ExecuteTime": {
861-
"end_time": "2020-04-28T09:24:56.505700Z",
862-
"start_time": "2020-04-28T09:24:53.019392Z"
861+
"end_time": "2020-05-02T17:07:39.436995Z",
862+
"start_time": "2020-05-02T17:07:36.729508Z"
863863
},
864864
"colab": {
865865
"base_uri": "https://localhost:8080/",
@@ -874,7 +874,7 @@
874874
"name": "stderr",
875875
"output_type": "stream",
876876
"text": [
877-
"/Users/Maksim/Library/Python/3.6/lib/python/site-packages/ipykernel_launcher.py:2: UserWarning: It is recommended to use this approach on treatment balanced data. Current sample size is unbalanced.\n",
877+
"/Users/Maksim/Library/Python/3.6/lib/python/site-packages/ipykernel_launcher.py:6: UserWarning: It is recommended to use this approach on treatment balanced data. Current sample size is unbalanced.\n",
878878
" \n"
879879
]
880880
},
@@ -891,10 +891,15 @@
891891
}
892892
],
893893
"source": [
894-
"cm_full = ClassTransformation(CatBoostClassifier(iterations=20, thread_count=2, random_state=42, silent=True))\n",
895-
"cm_full = cm_full.fit(X_train_full, y_train_full, treat_train_full, estimator_fit_params={'cat_features': [1]})\n",
894+
"ct_full = ClassTransformation(CatBoostClassifier(iterations=20, thread_count=2, random_state=42, silent=True))\n",
895+
"ct_full = ct_full.fit(\n",
896+
" X_train_full, \n",
897+
" y_train_full, \n",
898+
" treat_train_full, \n",
899+
" estimator_fit_params={'cat_features': cat_features}\n",
900+
")\n",
896901
"\n",
897-
"X_test.loc[:, 'uplift'] = cm_full.predict(X_test.values)\n",
902+
"X_test.loc[:, 'uplift'] = ct_full.predict(X_test.values)\n",
898903
"\n",
899904
"sub = X_test[['uplift']].to_csv('sub1.csv')\n",
900905
"\n",
@@ -906,8 +911,8 @@
906911
"execution_count": 12,
907912
"metadata": {
908913
"ExecuteTime": {
909-
"end_time": "2020-04-28T09:24:56.560018Z",
910-
"start_time": "2020-04-28T09:24:56.508541Z"
914+
"end_time": "2020-05-02T17:07:39.478855Z",
915+
"start_time": "2020-05-02T17:07:39.440546Z"
911916
},
912917
"colab": {
913918
"base_uri": "https://localhost:8080/",
@@ -988,12 +993,12 @@
988993
}
989994
],
990995
"source": [
991-
"cm_full_fi = pd.DataFrame({\n",
992-
" 'feature_name': cm_full.estimator.feature_names_,\n",
993-
" 'feature_score': cm_full.estimator.feature_importances_\n",
996+
"ct_full_fi = pd.DataFrame({\n",
997+
" 'feature_name': ct_full.estimator.feature_names_,\n",
998+
" 'feature_score': ct_full.estimator.feature_importances_\n",
994999
"}).sort_values('feature_score', ascending=False).reset_index(drop=True)\n",
9951000
"\n",
996-
"cm_full_fi"
1001+
"ct_full_fi"
9971002
]
9981003
},
9991004
{

notebooks/RetailHero_EN.ipynb

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@
9898
"execution_count": 1,
9999
"metadata": {
100100
"ExecuteTime": {
101-
"end_time": "2020-04-28T09:26:59.973637Z",
102-
"start_time": "2020-04-28T09:26:59.969856Z"
101+
"end_time": "2020-05-02T17:03:42.686542Z",
102+
"start_time": "2020-05-02T17:03:42.682766Z"
103103
},
104104
"colab": {
105105
"base_uri": "https://localhost:8080/",
@@ -117,7 +117,7 @@
117117
"urllib.request.urlretrieve(url, '/content/retail_hero.zip')\n",
118118
"\n",
119119
"!unzip /content/retail_hero.zip\n",
120-
"!pip install scikit-uplift==0.1.1 catboost=0.22"
120+
"!pip install scikit-uplift==0.1.2 catboost=0.22"
121121
]
122122
},
123123
{
@@ -135,8 +135,8 @@
135135
"execution_count": 2,
136136
"metadata": {
137137
"ExecuteTime": {
138-
"end_time": "2020-04-28T09:27:03.353098Z",
139-
"start_time": "2020-04-28T09:26:59.984369Z"
138+
"end_time": "2020-05-02T17:03:45.696618Z",
139+
"start_time": "2020-05-02T17:03:42.697098Z"
140140
},
141141
"colab": {},
142142
"colab_type": "code",
@@ -187,8 +187,8 @@
187187
"execution_count": 3,
188188
"metadata": {
189189
"ExecuteTime": {
190-
"end_time": "2020-04-28T09:27:04.563554Z",
191-
"start_time": "2020-04-28T09:27:03.355432Z"
190+
"end_time": "2020-05-02T17:03:46.792933Z",
191+
"start_time": "2020-05-02T17:03:45.698939Z"
192192
},
193193
"colab": {},
194194
"colab_type": "code",
@@ -241,8 +241,8 @@
241241
"execution_count": 4,
242242
"metadata": {
243243
"ExecuteTime": {
244-
"end_time": "2020-04-28T09:27:06.789462Z",
245-
"start_time": "2020-04-28T09:27:04.570306Z"
244+
"end_time": "2020-05-02T17:03:48.848922Z",
245+
"start_time": "2020-05-02T17:03:46.795574Z"
246246
},
247247
"colab": {
248248
"base_uri": "https://localhost:8080/",
@@ -305,8 +305,8 @@
305305
"execution_count": 5,
306306
"metadata": {
307307
"ExecuteTime": {
308-
"end_time": "2020-04-28T09:27:06.813310Z",
309-
"start_time": "2020-04-28T09:27:06.792837Z"
308+
"end_time": "2020-05-02T17:03:48.871869Z",
309+
"start_time": "2020-05-02T17:03:48.851856Z"
310310
},
311311
"colab": {
312312
"base_uri": "https://localhost:8080/",
@@ -476,8 +476,8 @@
476476
"execution_count": 6,
477477
"metadata": {
478478
"ExecuteTime": {
479-
"end_time": "2020-04-28T09:27:07.960855Z",
480-
"start_time": "2020-04-28T09:27:06.816440Z"
479+
"end_time": "2020-05-02T17:03:49.905064Z",
480+
"start_time": "2020-05-02T17:03:48.875206Z"
481481
},
482482
"colab": {
483483
"base_uri": "https://localhost:8080/",
@@ -538,8 +538,8 @@
538538
"execution_count": 7,
539539
"metadata": {
540540
"ExecuteTime": {
541-
"end_time": "2020-04-28T09:27:10.062915Z",
542-
"start_time": "2020-04-28T09:27:07.972200Z"
541+
"end_time": "2020-05-02T17:03:51.782971Z",
542+
"start_time": "2020-05-02T17:03:49.907481Z"
543543
},
544544
"colab": {
545545
"base_uri": "https://localhost:8080/",
@@ -627,8 +627,8 @@
627627
"execution_count": 8,
628628
"metadata": {
629629
"ExecuteTime": {
630-
"end_time": "2020-04-28T09:27:12.177386Z",
631-
"start_time": "2020-04-28T09:27:10.065653Z"
630+
"end_time": "2020-05-02T17:03:53.820694Z",
631+
"start_time": "2020-05-02T17:03:51.785856Z"
632632
},
633633
"colab": {
634634
"base_uri": "https://localhost:8080/",
@@ -689,8 +689,8 @@
689689
"execution_count": 9,
690690
"metadata": {
691691
"ExecuteTime": {
692-
"end_time": "2020-04-28T09:27:14.459477Z",
693-
"start_time": "2020-04-28T09:27:12.181749Z"
692+
"end_time": "2020-05-02T17:03:56.085589Z",
693+
"start_time": "2020-05-02T17:03:53.824592Z"
694694
},
695695
"colab": {
696696
"base_uri": "https://localhost:8080/",
@@ -753,8 +753,8 @@
753753
"execution_count": 10,
754754
"metadata": {
755755
"ExecuteTime": {
756-
"end_time": "2020-04-28T09:27:14.480794Z",
757-
"start_time": "2020-04-28T09:27:14.463302Z"
756+
"end_time": "2020-05-02T17:03:56.140144Z",
757+
"start_time": "2020-05-02T17:03:56.091196Z"
758758
},
759759
"colab": {
760760
"base_uri": "https://localhost:8080/",
@@ -853,8 +853,8 @@
853853
"execution_count": 11,
854854
"metadata": {
855855
"ExecuteTime": {
856-
"end_time": "2020-04-28T09:27:17.097949Z",
857-
"start_time": "2020-04-28T09:27:14.483691Z"
856+
"end_time": "2020-05-02T17:03:59.864286Z",
857+
"start_time": "2020-05-02T17:03:56.151623Z"
858858
},
859859
"colab": {
860860
"base_uri": "https://localhost:8080/",
@@ -886,10 +886,15 @@
886886
}
887887
],
888888
"source": [
889-
"cm_full = ClassTransformation(CatBoostClassifier(iterations=20, thread_count=2, random_state=42, silent=True))\n",
890-
"cm_full = cm_full.fit(X_train_full, y_train_full, treat_train_full, estimator_fit_params={'cat_features': [1]})\n",
889+
"ct_full = ClassTransformation(CatBoostClassifier(iterations=20, thread_count=2, random_state=42, silent=True))\n",
890+
"ct_full = ct_full.fit(\n",
891+
" X_train_full, \n",
892+
" y_train_full, \n",
893+
" treat_train_full, \n",
894+
" estimator_fit_params={'cat_features': cat_features}\n",
895+
")\n",
891896
"\n",
892-
"X_test.loc[:, 'uplift'] = cm_full.predict(X_test.values)\n",
897+
"X_test.loc[:, 'uplift'] = ct_full.predict(X_test.values)\n",
893898
"\n",
894899
"sub = X_test[['uplift']].to_csv('sub1.csv')\n",
895900
"\n",
@@ -901,8 +906,8 @@
901906
"execution_count": 12,
902907
"metadata": {
903908
"ExecuteTime": {
904-
"end_time": "2020-04-28T09:27:17.138755Z",
905-
"start_time": "2020-04-28T09:27:17.101433Z"
909+
"end_time": "2020-05-02T17:03:59.898275Z",
910+
"start_time": "2020-05-02T17:03:59.868331Z"
906911
},
907912
"colab": {
908913
"base_uri": "https://localhost:8080/",
@@ -983,12 +988,12 @@
983988
}
984989
],
985990
"source": [
986-
"cm_full_fi = pd.DataFrame({\n",
987-
" 'feature_name': cm_full.estimator.feature_names_,\n",
988-
" 'feature_score': cm_full.estimator.feature_importances_\n",
991+
"ct_full = pd.DataFrame({\n",
992+
" 'feature_name': ct_full.estimator.feature_names_,\n",
993+
" 'feature_score': ct_full.estimator.feature_importances_\n",
989994
"}).sort_values('feature_score', ascending=False).reset_index(drop=True)\n",
990995
"\n",
991-
"cm_full_fi"
996+
"ct_full"
992997
]
993998
},
994999
{

0 commit comments

Comments
 (0)