Skip to content

Commit 768d66c

Browse files
committed
Split slow(?) cell in sklearn_tiledb_models_example notebook
1 parent 7f029ca commit 768d66c

File tree

1 file changed

+43
-29
lines changed

1 file changed

+43
-29
lines changed

examples/models/sklearn_tiledb_models_example.ipynb

+43-29
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@
6565
"name": "stdout",
6666
"output_type": "stream",
6767
"text": [
68-
"Data fetching...\n",
69-
"Data scaling...\n"
68+
"Data fetching...\n"
7069
]
7170
}
7271
],
@@ -76,8 +75,23 @@
7675
"\n",
7776
"# Load data from https://www.openml.org/d/554\n",
7877
"print('Data fetching...')\n",
79-
"X, y = fetch_openml('mnist_784', version=1, return_X_y=True, as_frame=False, data_home=data_home)\n",
80-
"\n",
78+
"X, y = fetch_openml('mnist_784', version=1, return_X_y=True, as_frame=False, data_home=data_home)"
79+
]
80+
},
81+
{
82+
"cell_type": "code",
83+
"execution_count": 3,
84+
"metadata": {},
85+
"outputs": [
86+
{
87+
"name": "stdout",
88+
"output_type": "stream",
89+
"text": [
90+
"Data scaling...\n"
91+
]
92+
}
93+
],
94+
"source": [
8195
"random_state = check_random_state(0)\n",
8296
"permutation = random_state.permutation(X.shape[0])\n",
8397
"X = X[permutation]\n",
@@ -106,7 +120,7 @@
106120
},
107121
{
108122
"cell_type": "code",
109-
"execution_count": 3,
123+
"execution_count": 4,
110124
"metadata": {
111125
"pycharm": {
112126
"name": "#%%\n"
@@ -119,8 +133,8 @@
119133
"text": [
120134
"Model fit...\n",
121135
"Model score...\n",
122-
"Sparsity with L1 penalty: 61.53%\n",
123-
"Test score with L1 penalty: 0.8325\n"
136+
"Sparsity with L1 penalty: 77.93%\n",
137+
"Test score with L1 penalty: 0.8298\n"
124138
]
125139
}
126140
],
@@ -158,7 +172,7 @@
158172
},
159173
{
160174
"cell_type": "code",
161-
"execution_count": 4,
175+
"execution_count": 5,
162176
"metadata": {
163177
"pycharm": {
164178
"name": "#%%\n"
@@ -184,7 +198,7 @@
184198
},
185199
{
186200
"cell_type": "code",
187-
"execution_count": 5,
201+
"execution_count": 6,
188202
"metadata": {
189203
"pycharm": {
190204
"name": "#%%\n"
@@ -201,13 +215,13 @@
201215
" '../data/sklearn-mnist-1/__commits',\n",
202216
" '../data/sklearn-mnist-1/__schema']\n",
203217
"\n",
204-
"Key: Sparsity_with_L1_penalty, Value: 61.530612244897966\n",
218+
"Key: Sparsity_with_L1_penalty, Value: 77.93367346938776\n",
205219
"Key: TILEDB_ML_MODEL_ML_FRAMEWORK, Value: SKLEARN\n",
206220
"Key: TILEDB_ML_MODEL_ML_FRAMEWORK_VERSION, Value: 1.0.2\n",
207221
"Key: TILEDB_ML_MODEL_PREVIEW, Value: LogisticRegression(C=0.01, penalty='l1', solver='saga', tol=0.1)\n",
208222
"Key: TILEDB_ML_MODEL_PYTHON_VERSION, Value: 3.7.13\n",
209223
"Key: TILEDB_ML_MODEL_STAGE, Value: STAGING\n",
210-
"Key: score, Value: 0.8325\n"
224+
"Key: score, Value: 0.8298\n"
211225
]
212226
}
213227
],
@@ -236,7 +250,7 @@
236250
},
237251
{
238252
"cell_type": "code",
239-
"execution_count": 6,
253+
"execution_count": 7,
240254
"metadata": {
241255
"pycharm": {
242256
"name": "#%%\n"
@@ -247,14 +261,14 @@
247261
"name": "stdout",
248262
"output_type": "stream",
249263
"text": [
250-
"Key: Sparsity_with_L1_penalty, Value: 61.530612244897966\n",
264+
"Key: Sparsity_with_L1_penalty, Value: 77.93367346938776\n",
251265
"Key: TILEDB_ML_MODEL_ML_FRAMEWORK, Value: SKLEARN\n",
252266
"Key: TILEDB_ML_MODEL_ML_FRAMEWORK_VERSION, Value: 1.0.2\n",
253267
"Key: TILEDB_ML_MODEL_PREVIEW, Value: LogisticRegression(C=0.01, penalty='l1', solver='saga', tol=0.1)\n",
254268
"Key: TILEDB_ML_MODEL_PYTHON_VERSION, Value: 3.7.13\n",
255269
"Key: TILEDB_ML_MODEL_STAGE, Value: STAGING\n",
256270
"Key: new_meta, Value: [\"Any kind of info\"]\n",
257-
"Key: score, Value: 0.8325\n"
271+
"Key: score, Value: 0.8298\n"
258272
]
259273
}
260274
],
@@ -281,7 +295,7 @@
281295
},
282296
{
283297
"cell_type": "code",
284-
"execution_count": 7,
298+
"execution_count": 8,
285299
"metadata": {
286300
"pycharm": {
287301
"name": "#%%\n"
@@ -293,12 +307,12 @@
293307
"output_type": "stream",
294308
"text": [
295309
"Model score...\n",
296-
"Sparsity with L1 penalty: 61.53%\n",
297-
"Test score with L1 penalty: 0.8325\n",
310+
"Sparsity with L1 penalty: 77.93%\n",
311+
"Test score with L1 penalty: 0.8298\n",
298312
"Model fit...\n",
299313
"Model score...\n",
300-
"Sparsity with L1 penalty: 46.21%\n",
301-
"Test score with L1 penalty: 0.7401\n",
314+
"Sparsity with L1 penalty: 44.07%\n",
315+
"Test score with L1 penalty: 0.7194\n",
302316
"\n",
303317
"['../data/sklearn-mnist-1/__fragment_meta',\n",
304318
" '../data/sklearn-mnist-1/__meta',\n",
@@ -311,14 +325,14 @@
311325
"number of fragments: 2\n",
312326
"\n",
313327
"===== FRAGMENT NUMBER 0 =====\n",
314-
"timestamp range: (1660134739235, 1660134739235)\n",
328+
"timestamp range: (1664858394611, 1664858394611)\n",
315329
"number of unconsolidated metadata: 2\n",
316-
"version: 14\n",
330+
"version: 15\n",
317331
"\n",
318332
"===== FRAGMENT NUMBER 1 =====\n",
319-
"timestamp range: (1660134745067, 1660134745067)\n",
333+
"timestamp range: (1664858399506, 1664858399506)\n",
320334
"number of unconsolidated metadata: 2\n",
321-
"version: 14\n"
335+
"version: 15\n"
322336
]
323337
}
324338
],
@@ -390,7 +404,7 @@
390404
},
391405
{
392406
"cell_type": "code",
393-
"execution_count": 8,
407+
"execution_count": 9,
394408
"metadata": {
395409
"pycharm": {
396410
"name": "#%%\n"
@@ -402,7 +416,7 @@
402416
"output_type": "stream",
403417
"text": [
404418
"Fit...\n",
405-
"Test score: 0.7698\n"
419+
"Test score: 0.7755\n"
406420
]
407421
}
408422
],
@@ -436,7 +450,7 @@
436450
},
437451
{
438452
"cell_type": "code",
439-
"execution_count": 9,
453+
"execution_count": 10,
440454
"metadata": {
441455
"pycharm": {
442456
"name": "#%%\n"
@@ -449,7 +463,7 @@
449463
"'../data/tiledb-sklearn-mnist/sklearn-mnist-2'"
450464
]
451465
},
452-
"execution_count": 9,
466+
"execution_count": 10,
453467
"metadata": {},
454468
"output_type": "execute_result"
455469
}
@@ -470,7 +484,7 @@
470484
},
471485
{
472486
"cell_type": "code",
473-
"execution_count": 10,
487+
"execution_count": 11,
474488
"metadata": {
475489
"pycharm": {
476490
"name": "#%%\n"
@@ -512,4 +526,4 @@
512526
},
513527
"nbformat": 4,
514528
"nbformat_minor": 4
515-
}
529+
}

0 commit comments

Comments
 (0)