Skip to content

Commit

Permalink
Update notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Midorilly committed Dec 20, 2023
1 parent beaae93 commit 20ed240
Show file tree
Hide file tree
Showing 2 changed files with 336 additions and 8 deletions.
338 changes: 333 additions & 5 deletions notebooks/6.2.1-eg-deepchekcs-original-drift.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
"X_train, X_val, y_train, y_val = train_test_split(\n",
"\ttest_i,\n",
"\ttest_m,\n",
"\ttrain_size=.8,\n",
"\ttest_size=.2,\n",
"\ttrain_size=.7,\n",
"\ttest_size=.3,\n",
"\trandom_state=3,\n",
"\tshuffle=True\n",
")\n",
Expand Down Expand Up @@ -103,8 +103,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Number of training images: 83\n",
"Number of test images: 19\n",
"Number of training images: 71\n",
"Number of test images: 31\n",
"Example output of an image shape: torch.Size([3, 360, 480])\n",
"Example output of a label shape: torch.Size([360, 480])\n"
]
Expand Down Expand Up @@ -313,7 +313,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1b24d5c84f30479d8eb3df9bab05c9fa",
"model_id": "25a4a056ba834a45aadfc15141c764d7",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -328,6 +328,334 @@
"source": [
"training_data.head()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <style>\n",
" progress {\n",
" -webkit-appearance: none;\n",
" border: none;\n",
" border-radius: 3px;\n",
" width: 300px;\n",
" height: 20px;\n",
" vertical-align: middle;\n",
" margin-right: 10px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-bar {\n",
" border-radius: 3px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-value {\n",
" background-color: #9d60fb;\n",
" }\n",
" progress::-moz-progress-bar {\n",
" background-color: #9d60fb;\n",
" }\n",
" </style>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": []
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
" <style>\n",
" progress {\n",
" -webkit-appearance: none;\n",
" border: none;\n",
" border-radius: 3px;\n",
" width: 300px;\n",
" height: 20px;\n",
" vertical-align: middle;\n",
" margin-right: 10px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-bar {\n",
" border-radius: 3px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-value {\n",
" background-color: #9d60fb;\n",
" }\n",
" progress::-moz-progress-bar {\n",
" background-color: #9d60fb;\n",
" }\n",
" </style>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": []
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
" <style>\n",
" progress {\n",
" -webkit-appearance: none;\n",
" border: none;\n",
" border-radius: 3px;\n",
" width: 300px;\n",
" height: 20px;\n",
" vertical-align: middle;\n",
" margin-right: 10px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-bar {\n",
" border-radius: 3px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-value {\n",
" background-color: #9d60fb;\n",
" }\n",
" progress::-moz-progress-bar {\n",
" background-color: #9d60fb;\n",
" }\n",
" </style>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": []
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from deepchecks.vision.checks import PredictionDrift, ImageDatasetDrift\n",
"\n",
"check = PredictionDrift()\n",
"result = check.run(train_dataset=training_data, test_dataset=test_data)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "54c12c1faa7440b29e482e9b82f2b08a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HTML(value='<h4><b>Prediction Drift</b></h4>'), HTML(value='<p> Calculate prediction drift b…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"'../reports/linters/6.2.1-report-deepchecks-original-prediction-drift.html'"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result.show()\n",
"result.save_as_html('../reports/linters/6.2.1-report-deepchecks-original-prediction-drift.html')"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <style>\n",
" progress {\n",
" -webkit-appearance: none;\n",
" border: none;\n",
" border-radius: 3px;\n",
" width: 300px;\n",
" height: 20px;\n",
" vertical-align: middle;\n",
" margin-right: 10px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-bar {\n",
" border-radius: 3px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-value {\n",
" background-color: #9d60fb;\n",
" }\n",
" progress::-moz-progress-bar {\n",
" background-color: #9d60fb;\n",
" }\n",
" </style>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": []
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
" <style>\n",
" progress {\n",
" -webkit-appearance: none;\n",
" border: none;\n",
" border-radius: 3px;\n",
" width: 300px;\n",
" height: 20px;\n",
" vertical-align: middle;\n",
" margin-right: 10px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-bar {\n",
" border-radius: 3px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-value {\n",
" background-color: #9d60fb;\n",
" }\n",
" progress::-moz-progress-bar {\n",
" background-color: #9d60fb;\n",
" }\n",
" </style>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": []
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
" <style>\n",
" progress {\n",
" -webkit-appearance: none;\n",
" border: none;\n",
" border-radius: 3px;\n",
" width: 300px;\n",
" height: 20px;\n",
" vertical-align: middle;\n",
" margin-right: 10px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-bar {\n",
" border-radius: 3px;\n",
" background-color: aliceblue;\n",
" }\n",
" progress::-webkit-progress-value {\n",
" background-color: #9d60fb;\n",
" }\n",
" progress::-moz-progress-bar {\n",
" background-color: #9d60fb;\n",
" }\n",
" </style>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": []
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"check = ImageDatasetDrift()\n",
"result = check.run(train_dataset=training_data, test_dataset=test_data)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f9f33476d08940e9a3279a2d3a42a9e2",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HTML(value='<h4><b>Image Dataset Drift</b></h4>'), HTML(value='<p>Calculate drift between the e…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"'../reports/linters/6.2.2-report-deepchecks-original-dataset-drift.html'"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result.show()\n",
"result.save_as_html('../reports/linters/6.2.2-report-deepchecks-original-dataset-drift.html')"
]
}
],
"metadata": {
Expand Down
6 changes: 3 additions & 3 deletions notebooks/6.2.2-eg-deepchekcs-production-drift.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,23 @@
},
{
"cell_type": "code",
"execution_count": 81,
"execution_count": 98,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of training images: 71\n",
"Number of test images: 31\n",
"Number of production images: 31\n",
"Example output of an image shape: torch.Size([3, 360, 480])\n",
"Example output of a label shape: torch.Size([360, 480])\n"
]
}
],
"source": [
"print(f'Number of training images: {len(train_dataset)}')\n",
"print(f'Number of test images: {len(production_dataset)}')\n",
"print(f'Number of production images: {len(production_dataset)}')\n",
"print(f'Example output of an image shape: {train_dataset[0][0].shape}')\n",
"print(f'Example output of a label shape: {train_dataset[0][1].shape}')"
]
Expand Down

0 comments on commit 20ed240

Please sign in to comment.