411 lines
19 KiB
Plaintext
411 lines
19 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "804dacb6",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Load MNIST dataset"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"id": "7d09885b",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# Python ≥3.5 is required\n",
|
||
|
"import sys\n",
|
||
|
"assert sys.version_info >= (3, 5)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"id": "bf4121a0",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# scikit-learn ≥0.20 is required\n",
|
||
|
"import sklearn\n",
|
||
|
"assert sklearn.__version__ >= \"0.20\""
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"id": "71d91fd8",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# common imports\n",
|
||
|
"import numpy as np"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"id": "1dc68441",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"sklearn.utils.Bunch"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# import function to scikit-learn datasets\n",
|
||
|
"from sklearn.datasets import fetch_openml\n",
|
||
|
"\n",
|
||
|
"# load specified dataset (MNIST)\n",
|
||
|
"mnist = fetch_openml('mnist_784', version=1, as_frame=False)\n",
|
||
|
"\n",
|
||
|
"# print type of dataset\n",
|
||
|
"type(mnist)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"id": "2c7a4966",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"X, y = mnist[\"data\"], mnist[\"target\"]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "e2684670",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Fix labels"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 113,
|
||
|
"id": "dbdbc64f",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# import plotting libraries\n",
|
||
|
"import matplotlib as mpl\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"from math import isqrt, sqrt"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"id": "4c94aaf6",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# convert string labels to int\n",
|
||
|
"y = y.astype(np.uint8)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 126,
|
||
|
"id": "f1ba6703",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# function to quickly plot an image\n",
|
||
|
"def plot_digit(data):\n",
|
||
|
" image = data.reshape(28, 28)\n",
|
||
|
" plt.imshow(image, cmap = mpl.cm.binary, interpolation=\"nearest\")\n",
|
||
|
" plt.axis(\"off\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "eec5415d",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Prepare data for machine learning"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "27ed1cdb",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Identify Train Set and Test Set"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 9,
|
||
|
"id": "09446324",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"X_train: 56000, (56000, 784)\n",
|
||
|
"X_test: 14000, (14000, 784)\n",
|
||
|
"y_train: 56000, (56000,)\n",
|
||
|
"y_test: 14000, (14000,)\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from sklearn.model_selection import train_test_split\n",
|
||
|
"\n",
|
||
|
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=1337)\n",
|
||
|
"\n",
|
||
|
"print(f\"X_train: {len(X_train)}, {X_train.shape}\")\n",
|
||
|
"print(f\"X_test: {len(X_test)}, {X_test.shape}\")\n",
|
||
|
"print(f\"y_train: {len(y_train)}, {y_train.shape}\")\n",
|
||
|
"print(f\"y_test: {len(y_test)}, {y_test.shape}\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "2c3041ac",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Pipeline Declaration"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 10,
|
||
|
"id": "99f24362",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"from sklearn.pipeline import Pipeline\n",
|
||
|
"from sklearn.decomposition import PCA\n",
|
||
|
"from sklearn.preprocessing import StandardScaler, MinMaxScaler, MaxAbsScaler\n",
|
||
|
"from sklearn.neighbors import KNeighborsClassifier\n",
|
||
|
"from sklearn.model_selection import cross_val_predict\n",
|
||
|
"from sklearn.metrics import classification_report, accuracy_score\n",
|
||
|
"\n",
|
||
|
"n_neighbors = 3\n",
|
||
|
"n95_components = 0.95\n",
|
||
|
"n99_components = 0.99"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 122,
|
||
|
"id": "a6ee7588",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"(3, 3)"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 122,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"names = ['scaler', \n",
|
||
|
" 'minmax', \n",
|
||
|
" 'maxabs', \n",
|
||
|
" ]\n",
|
||
|
"\n",
|
||
|
"classifiers = [\n",
|
||
|
" Pipeline([('scaler', StandardScaler())]),\n",
|
||
|
" Pipeline([('minmax', MinMaxScaler())]),\n",
|
||
|
" Pipeline([('maxabs', MaxAbsScaler())]),\n",
|
||
|
"]\n",
|
||
|
"\n",
|
||
|
"len(names), len(classifiers)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "650c96b4",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Crossvalidation"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 123,
|
||
|
"id": "584cb66b",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def cv(num):\n",
|
||
|
" name = names[num]\n",
|
||
|
" clf = classifiers[num]\n",
|
||
|
" i = 10000\n",
|
||
|
" _X_train = clf.fit_transform(X_train, y_train)\n",
|
||
|
" print(y_train[i])\n",
|
||
|
" plot_digit(_X_train[i])\n",
|
||
|
" return _X_train[i]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 128,
|
||
|
"id": "0b815be6",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "std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rNXrlwp95GRkXKfP39+4/bq1avy7PLly8s9nEdjQi8RJ4QSJ4QSJ4QSJ4QSJ4QSJ4RyzzkNRkdHG7c9e/aUZ9vuGlt+n52+vt9eqf0R1T1mp9PpPHr0qHHbunXrZL+dJO45oZeIE0KJE0KJE0KJE0KJE0KJE0K55wzT9n3OGzdulHvbnx98+PBhuVffF123bl15dvXq1eU+PDxc7gsXLiz3v5h7Tugl4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ7jlh+rnnhF4iTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgg1s2X/7Z8mA6aeT04IJU4IJU4IJU4IJU4IJU4I9V9xQCui+SkYGAAAAABJRU5ErkJggg==\n",
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"i = 10000\n",
|
||
|
"print(y_train[i])\n",
|
||
|
"plot_digit(X_train[i])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 132,
|
||
|
"id": "8640f2ad",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"3\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAOcAAADnCAYAAADl9EEgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAJdElEQVR4nO3d32uOfxzH8WumyczISMx23zFR8ytRiHY4O3PqTHHI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ExnNMaM5aco+Z+T9+/cyn52dLc1Sf2bO+55leHICpignYIpyAqYoJ2CKcgKmKCdginICpmzvra1SNCvs7u6W+cjIiMzVTO7Ro0fybE9Pj8yjOWnKKwKjWaCaUxZFUTx58kTmjUajNNuwYYM8m/rqxEgVc1CenIApygmYopyAKcoJmKKcgCnKCZiyHaVU+cq3aNywfft2mQ8MDMh8cHCwNIvGONeuXZP5xo0bZb5nzx6Zq5HE1NSUPHv37l2ZP3z4UObqytELFy7Is9E6W2rOKAXAb5QTMEU5AVOUEzBFOQFTlBMwRTkBU5XNOVNfmxatAKk85WxRxNdLRnPQ9vb20uzWrVvy7Pz8vMzfvHkj85cvX8pcvUpPrXQVRVFMTk7KPPps586dK806Ojrk2ehn5jjHjPDkBExRTsAU5QRMUU7AFOUETFFOwBTlBExlnXOmvE4u5QrHoiiKubk5mecUzczUNY+nT5+WZ589eybz169fy3x4eFjmamczmu9Gu6Tnz5+X+dq1a0uz1Dlm6pwz56sRy/DkBExRTsAU5QRMUU7AFOUETFFOwBTlBExlnXOq+U90P2uVc6nUGWr0Ojo1L4zmu/V6Xea1Wk3mx44dk7n6u0e7pKl7siqvco65mK+fA09OwBTlBExRTsAU5QRMUU7AFOUETFFOwJTt+zlT9z2V1JlWNO+LZrhRnlPKPDB1lpgyq6zyfa1V4ckJmKKcgCnKCZiinIApygmYopyAqcpGKdE/q0fjhpwrPqlfOxrzpIyBUqWMHHKPM1LGHamjkipWwiI8OQFTlBMwRTkBU5QTMEU5AVOUEzBFOQFTy3ZlLKLmpNEVjalyzjFzz0irnDUqjnPI3HhyAqYoJ2CKcgKmKCdginICpignYIpyAqaaluOVgcD/AU9OwBTlBExRTsAU5QRMUU7AFOUETP0Hj4dT7WBQ3HQAAAAASUVORK5CYII=\n",
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"a = cv(0)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 133,
|
||
|
"id": "3ef8cf89",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"3\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAOcAAADnCAYAAADl9EEgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGuElEQVR4nO3dS4jNcR/H8TOPy9ggyXVHKQtKUohsFKGsrWRBiFwWMxasXGpqIpKVHaVcFoqdLGaShYUdi9lYTIlYSFEUnt2z8v/+e87MmM/h9Vr69Dtzanp3yq/zn75fv351gDz/me43APyeOCGUOCGUOCGUOCHUzJbdf+XC1Ov73T/65IRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ4oRQbX8CkCkwPj7euI2MjJRnHz16VO737t0r9x07dpT748ePG7dZs2aVZ5lcPjkhlDghlDghlDghlDghlDghlDghVN+vX7+qvRz/Vrdv3y73u3fvTuj1nz592rh9+/ZtQq/d8vvs9PX1lfvu3bsbt4cPH5ZnZ850bd6l3/5SfHJCKHFCKHFCKHFCKHFCKHFCKHFCqH/ynvPWrVvlfuLEiXL//PnzhH7+zp07G7dVq1aVZ/fu3Vvu169fL/e274NWhoaGyn1wcLDr1/7HueeEXiJOCCVOCCVOCCVOCCVOCNWzVyk/fvwo9wsXLjRuV69eLc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IZQ4IZQ4IZQ4IZQ4IZR7zi5s3Lix3Pv7+8v927dvjdvp06fLs5s3by73NWvWlPtU+vr1a7m33Q9X1q9fX+5z5szp+rVT+eSEUOKEUOKEUOKEUOKEUOKEUB6NOQXu379f7vv372/cqmuWTqf9ymDt2rXlfvLkyXKv/ozfly9fyrNXrlwp95GRkXKfP39+4/bq1avy7PLly8s9nEdjQi8RJ4QSJ4QSJ4QSJ4QSJ4QSJ4RyzzkNRkdHG7c9e/aUZ9vuGlt+n52+vt9eqf0R1T1mp9PpPHr0qHHbunXrZL+dJO45oZeIE0KJE0KJE0KJE0KJE0KJE0K55wzT9n3OGzdulHvbnx98+PBhuVffF123bl15dvXq1eU+PDxc7gsXLiz3v5h7Tugl4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ7jlh+rnnhF4iTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgg1s2X/7Z8mA6aeT04IJU4IJU4IJU4IJU4IJU4I9V9xQCui+SkYGAAAAABJRU5ErkJggg==\n",
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"a = cv(1)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 134,
|
||
|
"id": "fe0246a2",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"3\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAOcAAADnCAYAAADl9EEgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNp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bnx98+PBhuVffF123bl15dvXq1eU+PDxc7gsXLiz3v5h7Tugl4oRQ4oRQ4oRQ4oRQ4oRQ4oRQ7jlh+rnnhF4iTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgglTgg1s2X/7Z8mA6aeT04IJU4IJU4IJU4IJU4IJU4I9V9xQCui+SkYGAAAAABJRU5ErkJggg==\n",
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"a = cv(2)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "87a073e1",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"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.5"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|