Skip to content

Commit

Permalink
Split slow(?) cell in sklearn_tiledb_models_example notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
gsakkis committed Oct 4, 2022
1 parent 7f029ca commit 768d66c
Showing 1 changed file with 43 additions and 29 deletions.
72 changes: 43 additions & 29 deletions examples/models/sklearn_tiledb_models_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Data fetching...\n",
"Data scaling...\n"
"Data fetching...\n"
]
}
],
Expand All @@ -76,8 +75,23 @@
"\n",
"# Load data from https://www.openml.org/d/554\n",
"print('Data fetching...')\n",
"X, y = fetch_openml('mnist_784', version=1, return_X_y=True, as_frame=False, data_home=data_home)\n",
"\n",
"X, y = fetch_openml('mnist_784', version=1, return_X_y=True, as_frame=False, data_home=data_home)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Data scaling...\n"
]
}
],
"source": [
"random_state = check_random_state(0)\n",
"permutation = random_state.permutation(X.shape[0])\n",
"X = X[permutation]\n",
Expand Down Expand Up @@ -106,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {
"pycharm": {
"name": "#%%\n"
Expand All @@ -119,8 +133,8 @@
"text": [
"Model fit...\n",
"Model score...\n",
"Sparsity with L1 penalty: 61.53%\n",
"Test score with L1 penalty: 0.8325\n"
"Sparsity with L1 penalty: 77.93%\n",
"Test score with L1 penalty: 0.8298\n"
]
}
],
Expand Down Expand Up @@ -158,7 +172,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {
"pycharm": {
"name": "#%%\n"
Expand All @@ -184,7 +198,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {
"pycharm": {
"name": "#%%\n"
Expand All @@ -201,13 +215,13 @@
" '../data/sklearn-mnist-1/__commits',\n",
" '../data/sklearn-mnist-1/__schema']\n",
"\n",
"Key: Sparsity_with_L1_penalty, Value: 61.530612244897966\n",
"Key: Sparsity_with_L1_penalty, Value: 77.93367346938776\n",
"Key: TILEDB_ML_MODEL_ML_FRAMEWORK, Value: SKLEARN\n",
"Key: TILEDB_ML_MODEL_ML_FRAMEWORK_VERSION, Value: 1.0.2\n",
"Key: TILEDB_ML_MODEL_PREVIEW, Value: LogisticRegression(C=0.01, penalty='l1', solver='saga', tol=0.1)\n",
"Key: TILEDB_ML_MODEL_PYTHON_VERSION, Value: 3.7.13\n",
"Key: TILEDB_ML_MODEL_STAGE, Value: STAGING\n",
"Key: score, Value: 0.8325\n"
"Key: score, Value: 0.8298\n"
]
}
],
Expand Down Expand Up @@ -236,7 +250,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {
"pycharm": {
"name": "#%%\n"
Expand All @@ -247,14 +261,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Key: Sparsity_with_L1_penalty, Value: 61.530612244897966\n",
"Key: Sparsity_with_L1_penalty, Value: 77.93367346938776\n",
"Key: TILEDB_ML_MODEL_ML_FRAMEWORK, Value: SKLEARN\n",
"Key: TILEDB_ML_MODEL_ML_FRAMEWORK_VERSION, Value: 1.0.2\n",
"Key: TILEDB_ML_MODEL_PREVIEW, Value: LogisticRegression(C=0.01, penalty='l1', solver='saga', tol=0.1)\n",
"Key: TILEDB_ML_MODEL_PYTHON_VERSION, Value: 3.7.13\n",
"Key: TILEDB_ML_MODEL_STAGE, Value: STAGING\n",
"Key: new_meta, Value: [\"Any kind of info\"]\n",
"Key: score, Value: 0.8325\n"
"Key: score, Value: 0.8298\n"
]
}
],
Expand All @@ -281,7 +295,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {
"pycharm": {
"name": "#%%\n"
Expand All @@ -293,12 +307,12 @@
"output_type": "stream",
"text": [
"Model score...\n",
"Sparsity with L1 penalty: 61.53%\n",
"Test score with L1 penalty: 0.8325\n",
"Sparsity with L1 penalty: 77.93%\n",
"Test score with L1 penalty: 0.8298\n",
"Model fit...\n",
"Model score...\n",
"Sparsity with L1 penalty: 46.21%\n",
"Test score with L1 penalty: 0.7401\n",
"Sparsity with L1 penalty: 44.07%\n",
"Test score with L1 penalty: 0.7194\n",
"\n",
"['../data/sklearn-mnist-1/__fragment_meta',\n",
" '../data/sklearn-mnist-1/__meta',\n",
Expand All @@ -311,14 +325,14 @@
"number of fragments: 2\n",
"\n",
"===== FRAGMENT NUMBER 0 =====\n",
"timestamp range: (1660134739235, 1660134739235)\n",
"timestamp range: (1664858394611, 1664858394611)\n",
"number of unconsolidated metadata: 2\n",
"version: 14\n",
"version: 15\n",
"\n",
"===== FRAGMENT NUMBER 1 =====\n",
"timestamp range: (1660134745067, 1660134745067)\n",
"timestamp range: (1664858399506, 1664858399506)\n",
"number of unconsolidated metadata: 2\n",
"version: 14\n"
"version: 15\n"
]
}
],
Expand Down Expand Up @@ -390,7 +404,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {
"pycharm": {
"name": "#%%\n"
Expand All @@ -402,7 +416,7 @@
"output_type": "stream",
"text": [
"Fit...\n",
"Test score: 0.7698\n"
"Test score: 0.7755\n"
]
}
],
Expand Down Expand Up @@ -436,7 +450,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {
"pycharm": {
"name": "#%%\n"
Expand All @@ -449,7 +463,7 @@
"'../data/tiledb-sklearn-mnist/sklearn-mnist-2'"
]
},
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -470,7 +484,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {
"pycharm": {
"name": "#%%\n"
Expand Down Expand Up @@ -512,4 +526,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}

0 comments on commit 768d66c

Please sign in to comment.