commit merge?

master
Tuan-Dat Tran 2021-07-14 10:29:00 +02:00
commit b0fa42689d
8 changed files with 681 additions and 193 deletions

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "879144d9", "id": "8301251c",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Load MNIST dataset" "### Load MNIST dataset"
@ -11,7 +11,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"id": "bd032860", "id": "3368e2c3",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -23,7 +23,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "30da011c", "id": "0dc2fe45",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -35,7 +35,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"id": "4f555050", "id": "30459411",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -46,7 +46,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"id": "e4de4331", "id": "0be717f8",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -74,7 +74,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 5,
"id": "b5221963", "id": "ae9b3d51",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -83,7 +83,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "811db75a", "id": "7c89b6d3",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### labels to int" "### labels to int"
@ -92,7 +92,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"id": "2bcc19ad", "id": "30880538",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -104,7 +104,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"id": "cc4b728f", "id": "34b6be41",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -114,7 +114,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "d7113df3", "id": "361fea4c",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Prepare data for machine learning" "### Prepare data for machine learning"
@ -122,7 +122,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "570f328e", "id": "cab5977a",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Identify Train Set and Test Set" "### Identify Train Set and Test Set"
@ -131,7 +131,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 8,
"id": "80e1ca03", "id": "9bb80760",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -158,7 +158,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "ade8a1f6", "id": "aac09882",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Pipeline Declaration" "## Pipeline Declaration"
@ -167,7 +167,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 9,
"id": "bc5896c2", "id": "ca389b56",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -195,7 +195,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "9e905584", "id": "b7c97601",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# Crossvalidation" "# Crossvalidation"
@ -204,7 +204,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 10,
"id": "bbbb447c", "id": "cd37833d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -222,7 +222,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 11,
"id": "4a8240c4", "id": "f738a4ca",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -240,7 +240,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 12,
"id": "f397cf42", "id": "756c8015",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -263,7 +263,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "a543706f", "id": "5d3b1484",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# Fitting" "# Fitting"
@ -272,7 +272,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 13,
"id": "45452ceb", "id": "1ea6a154",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -282,7 +282,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 14,
"id": "03c01cd0", "id": "ac4c7a18",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -333,7 +333,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 15,
"id": "18f02d0c", "id": "23c51b9e",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -385,7 +385,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 16,
"id": "b2e7ee09", "id": "8c92a008",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -437,7 +437,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 17,
"id": "23ae34c3", "id": "811c3930",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -490,7 +490,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 18,
"id": "cac23616", "id": "3c7440ff",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -543,7 +543,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 19,
"id": "a57eb660", "id": "8b491b79",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -596,7 +596,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 20,
"id": "bcbedf38", "id": "080ea6b8",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -649,7 +649,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 21,
"id": "5bc4f44b", "id": "6ee320cd",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -702,7 +702,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 22,
"id": "a901ad5d", "id": "17934567",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -755,7 +755,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 23,
"id": "19e87457", "id": "88fb14a4",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -816,7 +816,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 24,
"id": "6146ccb1", "id": "378c092b",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -877,7 +877,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 25,
"id": "66a7637b", "id": "3005da1d",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -930,7 +930,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 26,
"id": "d4fadaac", "id": "cbf8e245",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -983,7 +983,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 27,
"id": "d15fb11c", "id": "cc1c7c77",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1035,7 +1035,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 28,
"id": "2db8577b", "id": "562c937f",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1087,7 +1087,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 29,
"id": "a5702428", "id": "0c661938",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1104,7 +1104,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 30,
"id": "0ee57cfe", "id": "05b7b881",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1120,7 +1120,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "7fbbc930", "id": "0a37b9d8",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# Auswertung" "# Auswertung"
@ -1129,7 +1129,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 31,
"id": "e5d609aa", "id": "480adf73",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1147,7 +1147,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 38, "execution_count": 38,
"id": "234f14bb", "id": "202ff9a7",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1179,7 +1179,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "a6ddb6f2", "id": "94f1af95",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Default n=3\\\n", "Default n=3\\\n",
@ -1202,7 +1202,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "bde6e847", "id": "99ad8309",
"metadata": {}, "metadata": {},
"source": [ "source": [
"n=3 euclid distance\\\n", "n=3 euclid distance\\\n",
@ -1225,7 +1225,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "4c625bc3", "id": "497d3216",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# Hyper Parameter Optimization" "# Hyper Parameter Optimization"
@ -1234,7 +1234,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 34,
"id": "24ff7ea2", "id": "e5e0c930",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1269,7 +1269,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36, "execution_count": 36,
"id": "b3b0eac3", "id": "41349c36",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1279,7 +1279,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37, "execution_count": 37,
"id": "b68589fe", "id": "91d2f4bc",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1289,7 +1289,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "b162e908", "id": "c031b179",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
@ -1311,7 +1311,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.5" "version": "3.8.10"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "7a0c752a", "id": "6904e7ae",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Load MNIST dataset" "### Load MNIST dataset"
@ -11,7 +11,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"id": "e07d82fe", "id": "e3d41c8f",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -23,7 +23,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "1f97dcb1", "id": "55990ccc",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -35,7 +35,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"id": "01f83832", "id": "933f52fb",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -46,7 +46,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"id": "affa0e2b", "id": "41435175",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -73,7 +73,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "4d51fd43", "id": "fe14558d",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Bunch objects are sometimes used as an output for functions and methods. They extend dictionaries by enabling values to be accessed by key, bunch[\"value_key\"], or by an attribute, bunch.value_key.\\\n", "Bunch objects are sometimes used as an output for functions and methods. They extend dictionaries by enabling values to be accessed by key, bunch[\"value_key\"], or by an attribute, bunch.value_key.\\\n",
@ -83,7 +83,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 5,
"id": "78be57ab", "id": "80a39a2e",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -106,7 +106,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"id": "d0450c41", "id": "5c211b9c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -127,7 +127,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "e61e2adb", "id": "a4c5fb8d",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Datasets loaded by Scikit-Learn generally have a similar dictionary structure, including the following:\\\n", "Datasets loaded by Scikit-Learn generally have a similar dictionary structure, including the following:\\\n",
@ -139,7 +139,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"id": "fe285433", "id": "7c077427",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -159,7 +159,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "5a70a746", "id": "f3f2e42a",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Prepare the MNIST dataset" "### Prepare the MNIST dataset"
@ -167,7 +167,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "a9b7a120", "id": "6d5d2658",
"metadata": {}, "metadata": {},
"source": [ "source": [
"$f(X) = y$\n", "$f(X) = y$\n",
@ -181,7 +181,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 8,
"id": "4e02cf2a", "id": "99784cec",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -191,7 +191,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 9,
"id": "001d736f", "id": "923676c7",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -212,7 +212,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 10,
"id": "b344be1d", "id": "ed44fc7a",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -233,7 +233,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 11,
"id": "cef23e9f", "id": "94ee3e59",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -253,7 +253,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "fe3b1259", "id": "478cb336",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Plot data" "### Plot data"
@ -262,7 +262,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 12,
"id": "953d9415", "id": "f3cfebc6",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -274,7 +274,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 13,
"id": "b68f6cee", "id": "6d799c25",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -297,7 +297,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 14,
"id": "8779b1a2", "id": "72c7305b",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -317,7 +317,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 15,
"id": "dcc605cf", "id": "f5b0b349",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -343,7 +343,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 16,
"id": "6d41d752", "id": "c70641f8",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -364,7 +364,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 17,
"id": "230cfd35", "id": "98f8561b",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -375,7 +375,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 18,
"id": "25a3a2e7", "id": "33e244b2",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -389,7 +389,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 19,
"id": "f1552762", "id": "20043b74",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -413,7 +413,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 20,
"id": "74b3a063", "id": "6e4369de",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -429,7 +429,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 21,
"id": "949b3914", "id": "fb3f6d95",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -454,7 +454,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "ec8a9d34", "id": "3a69d0fd",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Prepare data for machine learning" "### Prepare data for machine learning"
@ -463,7 +463,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 22,
"id": "febbd286", "id": "dcc31672",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -485,7 +485,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 23,
"id": "fff839b6", "id": "282ba914",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -495,7 +495,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "2bdbeb4e", "id": "5c34bbd5",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Train classifier" "### Train classifier"
@ -504,7 +504,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 24,
"id": "4c32ae9f", "id": "f0b6e1c9",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -515,7 +515,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 25,
"id": "fe06ae55", "id": "54e3fb64",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -540,7 +540,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 26,
"id": "e6209258", "id": "29446c32",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -565,7 +565,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 27,
"id": "62773b1b", "id": "5030ccc3",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -584,7 +584,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 28,
"id": "0ce21474", "id": "22c780fb",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -603,7 +603,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 29,
"id": "78a8e8a7", "id": "990d3925",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -626,7 +626,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 30,
"id": "45d93a99", "id": "b6e1d70c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -647,7 +647,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "fc739051", "id": "a65ed630",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Evaluation" "### Evaluation"
@ -656,7 +656,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 31,
"id": "990a5b7c", "id": "4c93c5f9",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -677,7 +677,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 32,
"id": "f125a37d", "id": "f01ec3dd",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -697,7 +697,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "bdcb6e6e", "id": "c41db6b0",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Accuracy is strongly influenced by the distribution of the classes in the test data." "Accuracy is strongly influenced by the distribution of the classes in the test data."
@ -705,7 +705,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "be858cd5", "id": "3f830f36",
"metadata": {}, "metadata": {},
"source": [ "source": [
"#### Cross Validation\n", "#### Cross Validation\n",
@ -715,7 +715,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 33,
"id": "7adb1ea7", "id": "eeec5311",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -736,7 +736,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 34,
"id": "11d22c5e", "id": "d1ed46a3",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -759,7 +759,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "b54e83a5", "id": "539cfa0c",
"metadata": {}, "metadata": {},
"source": [ "source": [
"#### Precision" "#### Precision"
@ -768,7 +768,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 35,
"id": "ef7a9e7e", "id": "abfe8383",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -790,7 +790,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "da723740", "id": "d899dd6f",
"metadata": {}, "metadata": {},
"source": [ "source": [
"#### Recall" "#### Recall"
@ -799,7 +799,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36, "execution_count": 36,
"id": "cb77bf58", "id": "15d30ae5",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -821,7 +821,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "28867d1b", "id": "393c3b1c",
"metadata": {}, "metadata": {},
"source": [ "source": [
"#### F1 Score" "#### F1 Score"
@ -830,7 +830,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37, "execution_count": 37,
"id": "0674e0de", "id": "53fa1823",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -852,7 +852,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "da59da11", "id": "08b6bdc2",
"metadata": {}, "metadata": {},
"source": [ "source": [
"#### Confusion Matrix" "#### Confusion Matrix"
@ -861,7 +861,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 38, "execution_count": 38,
"id": "adbdeece", "id": "e205d359",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -891,7 +891,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 39, "execution_count": 39,
"id": "fb50c5a4", "id": "4ec777ac",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -929,7 +929,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40, "execution_count": 40,
"id": "2f0d536a", "id": "9c53a0a7",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -940,7 +940,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 41, "execution_count": 41,
"id": "dddf5fe8", "id": "c47e7c69",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -970,7 +970,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 42, "execution_count": 42,
"id": "44537aae", "id": "ef09fc40",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1006,7 +1006,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "57d96f56", "id": "6f9816f1",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
@ -1028,7 +1028,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.5" "version": "3.8.10"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -3,7 +3,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"id": "bfe7a783", "id": "9f0ddabb",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -16,7 +16,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "c6c356ef", "id": "1e8e6ffb",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -32,7 +32,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"id": "69ae3c7a", "id": "39cf526d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -48,7 +48,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"id": "e28642ea", "id": "2b169e1f",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -67,7 +67,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 5,
"id": "6ec561b1", "id": "9a507393",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -89,7 +89,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"id": "e975b7b9", "id": "8d8da08e",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -121,7 +121,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"id": "7b7f497c", "id": "700db412",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -147,7 +147,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "55f47334", "id": "16cdb8f5",
"metadata": {}, "metadata": {},
"source": [ "source": [
"**How to fix this error**:\n", "**How to fix this error**:\n",
@ -160,7 +160,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 8,
"id": "7f9bb477", "id": "1f411bea",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -647,7 +647,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 9,
"id": "5d10cf20", "id": "1a8beb73",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -675,7 +675,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 10,
"id": "0e97563e", "id": "0dcd7db2",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -703,7 +703,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 11,
"id": "2676a564", "id": "3a0e96ac",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -714,7 +714,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 12,
"id": "a26a60ff", "id": "d2d8e64d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -724,7 +724,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 13,
"id": "39f3ef0e", "id": "77c502cd",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -753,7 +753,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 14,
"id": "1fa16a8f", "id": "7235d56c",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -769,7 +769,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 15,
"id": "eee9d775", "id": "cc983f80",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -809,7 +809,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 16,
"id": "27ae5c5a", "id": "59d6ebca",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -874,7 +874,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 17,
"id": "d2b3422e", "id": "f4032731",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -946,7 +946,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 18,
"id": "453149ff", "id": "e20cb3cd",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -989,7 +989,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 19,
"id": "dbf863e2", "id": "5f88c9c6",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1013,7 +1013,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.5" "version": "3.8.10"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -3,7 +3,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"id": "9706d045", "id": "024b33fe",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -15,7 +15,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "77388c0f", "id": "72397786",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -37,7 +37,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"id": "0fd516ff", "id": "5f67ba6c",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -56,7 +56,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"id": "389e84c0", "id": "805421f9",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -67,7 +67,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 5,
"id": "197a57c5", "id": "a6a00ee3",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -78,7 +78,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"id": "e456ab87", "id": "877573a2",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -117,7 +117,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "cc789523", "id": "93303e1e",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
@ -125,7 +125,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"id": "c59a84aa", "id": "5eb3f0c1",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -141,7 +141,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 8,
"id": "0c0a4649", "id": "26bcaaad",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -196,7 +196,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 9,
"id": "5a618dd4", "id": "32584756",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -212,7 +212,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 10,
"id": "52e5cc13", "id": "e7056b09",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -229,7 +229,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 11,
"id": "62463866", "id": "fad8741d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -241,7 +241,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 12,
"id": "57ec862e", "id": "96abe0b6",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -295,7 +295,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 13,
"id": "cc2a6529", "id": "2ec14876",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -306,7 +306,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 14,
"id": "66975d62", "id": "93d7b7e8",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -338,7 +338,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 15,
"id": "cc664cf6", "id": "bdd09b3a",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -360,7 +360,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 18,
"id": "d8463d51", "id": "b4b048c3",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -384,7 +384,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "bbb07d9b", "id": "d06cbda8",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
@ -406,7 +406,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.5" "version": "3.8.10"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -3,7 +3,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"id": "43a8508f", "id": "3168ef63",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -35,7 +35,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "650ab8d8", "id": "ce4d9517",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -54,7 +54,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"id": "7e5bbbe7", "id": "5ed60433",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -77,7 +77,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"id": "e2c35751", "id": "9fefd9fa",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -135,7 +135,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 5,
"id": "6a0e84e0", "id": "b6c30ab7",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -155,7 +155,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"id": "8a76bd49", "id": "20cb0504",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -211,7 +211,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"id": "95dbd528", "id": "ec39550d",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -230,7 +230,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 8,
"id": "f68432e1", "id": "63509028",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -240,7 +240,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 9,
"id": "48d57ee7", "id": "f8dbeac5",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -250,7 +250,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 10,
"id": "c8cf46a6", "id": "b479a77c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -268,7 +268,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 11,
"id": "016a11f0", "id": "3c7919a6",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -278,7 +278,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 15,
"id": "77b0373e", "id": "9592e2ca",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -296,7 +296,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 19,
"id": "d9f3bf08", "id": "7f294d3c",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -321,7 +321,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 20,
"id": "25729dda", "id": "fda2e601",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -61840,7 +61840,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "303c0850", "id": "d1125102",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
@ -61862,7 +61862,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.5" "version": "3.8.10"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -3,7 +3,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"id": "30758151", "id": "7528c5d7",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -19,7 +19,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "1365458a", "id": "5aa0ab63",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -94,7 +94,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"id": "cef98b83", "id": "c0453d68",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -106,7 +106,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"id": "86f1c9b4", "id": "685f2966",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -146,7 +146,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 5,
"id": "ab518f47", "id": "57b2847d",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -192,7 +192,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "a0c1292b", "id": "5784fe87",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
@ -214,7 +214,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.5" "version": "3.8.10"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -0,0 +1,276 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "2288179b",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 768/768 [01:11<00:00, 10.72it/s]\n"
]
}
],
"source": [
"import os\n",
"from glob import glob\n",
"import pandas as pd\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn.pipeline import Pipeline\n",
"from sklearn.decomposition import PCA, KernelPCA\n",
"from sklearn.preprocessing import (StandardScaler, \n",
" MinMaxScaler, \n",
" MaxAbsScaler,\n",
" PowerTransformer,\n",
" Binarizer)\n",
"\n",
"from sklearn.neighbors import KNeighborsClassifier\n",
"from sklearn.model_selection import cross_validate\n",
"from sklearn.metrics import classification_report, accuracy_score\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from math import isqrt\n",
"import pickle\n",
"from tqdm import tqdm\n",
"import os\n",
"\n",
"os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'\n",
"os.environ['CUDA_VISIBLE_DEVICES'] = '2'\n",
"\n",
"def load_data(user_filter=None):\n",
" dic_data = []\n",
" \n",
" for p in tqdm(glob('/opt/iui-datarelease3-sose2021/*.csv')):\n",
" path = p\n",
" filename = path.split('/')[-1]\n",
" user = int(filename.split('_')[0][1:])\n",
" if (user_filter):\n",
" if (user != user_filter):\n",
" continue\n",
" scenario = filename.split('_')[1][len('Scenario'):]\n",
" heightnorm = filename.split('_')[2][len('HeightNormalization'):] == 'True'\n",
" armnorm = filename.split('_')[3][len('ArmNormalization'):] == 'True'\n",
" rep = int(filename.split('.')[0].split('_')[4][len('Repetition'):])\n",
" session = filename.split('_')[5][len('Session'):]\n",
" session = session.split('.')[0]\n",
" \n",
" data = pd.read_csv(path)\n",
" dic_data.append(\n",
" {\n",
" 'filename': path,\n",
" 'user': user,\n",
" 'scenario': scenario,\n",
" 'heightnorm': heightnorm,\n",
" 'armnorm': armnorm,\n",
" 'rep': rep,\n",
" 'session': session,\n",
" 'data': data \n",
" \n",
" }\n",
" )\n",
" return dic_data\n",
"\n",
"dic_data = load_data()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "3df066af",
"metadata": {},
"outputs": [],
"source": [
"\n",
"# dataP = pd.DataFrame.from_dict(fil_dic_data) #pandas Dataframe Form mit 'data0' nur die daten\n",
"\n",
"# tempP = dataP['data']\n",
"\n",
"# tempP = tempP[0].drop(columns=['Scenario','HeightNormalization','ArmNormalization','LeftHandTrackingAccuracy','RightHandTrackingAccuracy']) #P without String Data\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "30296cad",
"metadata": {},
"outputs": [],
"source": [
"fil_dic_data = []\n",
"for d in dic_data:\n",
" if d['scenario'] == 'Sorting':\n",
" if d['heightnorm'] == d['armnorm']:\n",
" fil_dic_data.append(d)"
]
},
{
"cell_type": "markdown",
"id": "7a808f50",
"metadata": {},
"source": [
"Test\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "dc206ded",
"metadata": {},
"outputs": [],
"source": [
"min_Max = MinMaxScaler()\n",
"standard = StandardScaler()\n",
"max_Abs = MaxAbsScaler()\n",
"binarizer = Binarizer()\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "cf5b5695",
"metadata": {},
"outputs": [],
"source": [
"session_data_1 = []\n",
"session_data_2 = []\n",
"\n",
"user_data_1 = []\n",
"user_data_2 = []\n",
"\n",
"data_1 = []\n",
"data_2 = []\n",
"\n",
"for a in fil_dic_data:\n",
" if(a['session'] == '1'): ## Daten aus session 1 für train\n",
" session_data_1.append(a)\n",
" \n",
" if(a['session'] == '2'): ## Daten aus Session 2 zum validaten\n",
" session_data_2.append(a)\n",
"\n",
"for b in session_data_1:\n",
" user_data_1.append(b['user']) ## Label zu 1 \n",
" data_1.append(a['data'])\n",
" \n",
"for c in session_data_2:\n",
" user_data_2.append(b['user']) ## Label zu 2\n",
" data_2.append(a['data'])\n",
" \n",
" \n",
" "
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "82465bca",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 96/96 [00:00<00:00, 575.65it/s]\n",
"100%|██████████| 96/96 [00:00<00:00, 646.85it/s]\n"
]
}
],
"source": [
"dataF_1 = [] ## Filtered Data session 1\n",
"dataF_2 = [] ## Filtered Data session 2\n",
"\n",
"temp_1 = [] ## Temp Holder für 1\n",
"temp_2 = [] ## Temp Holder für 2\n",
"\n",
"counter = 0 ## Counter für Einspeisen der Daten\n",
"\n",
"\n",
"for a in data_1:\n",
" temp_1.append(pd.DataFrame(a))\n",
"\n",
"for b in data_2:\n",
" temp_2.append(pd.DataFrame(b))\n",
"\n",
"\n",
"for c in tqdm(temp_1):\n",
" dataF_1.append(c.drop(columns=['Scenario','HeightNormalization','ArmNormalization','LeftHandTrackingAccuracy','RightHandTrackingAccuracy','Unnamed: 0', 'FrameID','participantID','Repetition']))\n",
" counter +=1\n",
" \n",
"counter = 0\n",
"\n",
"for d in tqdm(temp_2):\n",
" dataF_2.append(c.drop(columns=['Scenario','HeightNormalization','ArmNormalization','LeftHandTrackingAccuracy','RightHandTrackingAccuracy','Unnamed: 0', 'FrameID','participantID','Repetition']))\n",
" counter +=1\n",
" \n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "a6f7076e",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 96/96 [00:03<00:00, 25.87it/s]\n"
]
}
],
"source": [
"minD = [] ## normalisierte Daten durch Minmax\n",
"staD = [] ## normalisierte Daten durch Standard\n",
"maxD = [] ## normalisierte Daten durch MaxAbs\n",
"binD = [] ## normalisierte Daten durch binarizer\n",
"\n",
"for i in tqdm(dataF_1):\n",
" minD.append( min_Max.fit_transform(i))\n",
" staD.append(standard.fit_transform(i))\n",
" maxD.append(max_Abs.fit_transform(i))\n",
" binD.append(binarizer.fit_transform(i))\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "94676652",
"metadata": {},
"outputs": [],
"source": [
"from sklearn.model_selection import train_test_split\n",
"x_train,x_test,y_train,y_test = train_test_split(minD,user_data_1,random_state=2)"
]
},
{
"cell_type": "markdown",
"id": "14a4abe1",
"metadata": {},
"source": [
"Classi"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

File diff suppressed because one or more lines are too long