Added Binarizer in Preprocessing and Hyperparameter optimization in pipeline

master
Tuan-Dat Tran 2021-05-18 17:18:26 +00:00
parent 8b647de135
commit b127bc6b84
4 changed files with 943 additions and 356 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "804dacb6",
"id": "f2885b56",
"metadata": {},
"source": [
"### Load MNIST dataset"
@ -11,7 +11,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "7d09885b",
"id": "805542e2",
"metadata": {},
"outputs": [],
"source": [
@ -23,7 +23,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "bf4121a0",
"id": "26d38ac4",
"metadata": {},
"outputs": [],
"source": [
@ -35,7 +35,7 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "71d91fd8",
"id": "749c3ec9",
"metadata": {},
"outputs": [],
"source": [
@ -46,7 +46,7 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "1dc68441",
"id": "810daa97",
"metadata": {},
"outputs": [
{
@ -74,7 +74,7 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "2c7a4966",
"id": "48b3d387",
"metadata": {},
"outputs": [],
"source": [
@ -83,7 +83,7 @@
},
{
"cell_type": "markdown",
"id": "e2684670",
"id": "96ed2a09",
"metadata": {},
"source": [
"### Fix labels"
@ -92,7 +92,7 @@
{
"cell_type": "code",
"execution_count": 113,
"id": "dbdbc64f",
"id": "4c537948",
"metadata": {},
"outputs": [],
"source": [
@ -105,7 +105,7 @@
{
"cell_type": "code",
"execution_count": 7,
"id": "4c94aaf6",
"id": "4d138b55",
"metadata": {},
"outputs": [],
"source": [
@ -116,7 +116,7 @@
{
"cell_type": "code",
"execution_count": 126,
"id": "f1ba6703",
"id": "b5284df4",
"metadata": {},
"outputs": [],
"source": [
@ -129,7 +129,7 @@
},
{
"cell_type": "markdown",
"id": "eec5415d",
"id": "a572aebf",
"metadata": {},
"source": [
"### Prepare data for machine learning"
@ -137,7 +137,7 @@
},
{
"cell_type": "markdown",
"id": "27ed1cdb",
"id": "3b5bc85f",
"metadata": {},
"source": [
"### Identify Train Set and Test Set"
@ -146,7 +146,7 @@
{
"cell_type": "code",
"execution_count": 9,
"id": "09446324",
"id": "3db579b6",
"metadata": {},
"outputs": [
{
@ -173,7 +173,7 @@
},
{
"cell_type": "markdown",
"id": "2c3041ac",
"id": "7c035dc8",
"metadata": {},
"source": [
"## Pipeline Declaration"
@ -181,14 +181,14 @@
},
{
"cell_type": "code",
"execution_count": 10,
"id": "99f24362",
"execution_count": 140,
"id": "4bd42611",
"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.preprocessing import StandardScaler, MinMaxScaler, MaxAbsScaler, Binarizer\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",
@ -200,17 +200,17 @@
},
{
"cell_type": "code",
"execution_count": 122,
"id": "a6ee7588",
"execution_count": 143,
"id": "c347de5b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(3, 3)"
"(4, 4)"
]
},
"execution_count": 122,
"execution_count": 143,
"metadata": {},
"output_type": "execute_result"
}
@ -218,13 +218,15 @@
"source": [
"names = ['scaler', \n",
" 'minmax', \n",
" 'maxabs', \n",
" 'maxabs',\n",
" 'bin'\n",
" ]\n",
"\n",
"classifiers = [\n",
" Pipeline([('scaler', StandardScaler())]),\n",
" Pipeline([('minmax', MinMaxScaler())]),\n",
" Pipeline([('maxabs', MaxAbsScaler())]),\n",
" Pipeline([('bin', Binarizer())]),\n",
"]\n",
"\n",
"len(names), len(classifiers)"
@ -232,7 +234,7 @@
},
{
"cell_type": "markdown",
"id": "650c96b4",
"id": "bd566c8d",
"metadata": {},
"source": [
"# Crossvalidation"
@ -241,7 +243,7 @@
{
"cell_type": "code",
"execution_count": 123,
"id": "584cb66b",
"id": "77f6d632",
"metadata": {},
"outputs": [],
"source": [
@ -258,7 +260,7 @@
{
"cell_type": "code",
"execution_count": 128,
"id": "0b815be6",
"id": "bb8eb2e0",
"metadata": {},
"outputs": [
{
@ -290,7 +292,7 @@
{
"cell_type": "code",
"execution_count": 132,
"id": "8640f2ad",
"id": "70f4411f",
"metadata": {},
"outputs": [
{
@ -320,7 +322,7 @@
{
"cell_type": "code",
"execution_count": 133,
"id": "3ef8cf89",
"id": "70f3533d",
"metadata": {},
"outputs": [
{
@ -350,7 +352,7 @@
{
"cell_type": "code",
"execution_count": 134,
"id": "fe0246a2",
"id": "2ec8d300",
"metadata": {},
"outputs": [
{
@ -377,10 +379,71 @@
"a = cv(2)"
]
},
{
"cell_type": "code",
"execution_count": 137,
"id": "b1f285c2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n",
"3\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAOcAAADnCAYAAADl9EEgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAADaklEQVR4nO3dQWqDUBRAUX/JwrI0l5ad2VHpRCJto17Tc4aVgB1cHuTx88eyLBPQ83H2CwDrxAlR4oQocUKUOCHqtvHcV7mwv7H2R5MTosQJUeKEKHFClDghSpwQJU6IEidEiROixAlR4oQocUKUOCFKnBAlTogSJ0SJE6LECVHihChxQpQ4IUqcECVOiBInRIkTosQJUeKEKHFClDghSpwQJU6IEidEiROixAlR4oQocUKUOCFKnBB1O/sFrmiM8afPL8vyojd5vWf/W/m935HJCVHihChxQpQ4IUqcECVOiBInRI2N3ZXFFuxvdblsckKUOCFKnBAlTogSJ0SJE6IcGftnto67ORbWYXJClDghSpwQJU6IEidEiROixAlRl91zPh6Pp8/v9/sh73E1f9lj2pEey+SEKHFClDghSpwQJU6IEidEiROiLrvn3JMd6jp7zGOZnBAlTogSJ0SJE6LECVHihChxQpQrAOF8rgCEKxEnRIkTosQJUeKEKHFClDghSpwQJU6IEidEiROixAlR4oQocUKUOCFKnBAlTogSJ0SJE6LECVHihChxQpQrAE8wxuovIU7T5Jo9vpmcECVOiBInRIkTosQJUeKEKHFClD3nCcq7zHmef/WM1zM5IUqcECVOiBInRIkTosQJUeKEqLGxc+su5OB9rB7wNTkhSpwQJU6IEidEiROixAlR4oQo5zk5zLPf652m9jnXM5icECVOiBInRIkTosQJUeKEKKsUDmNV8jMmJ0SJE6LECVHihChxQpQ4IUqcECVOiBInRIkTosQJUeKEKHFClDghSpwQJU6IEidEiROixAlR4oQocUKUOCFKnBDld2tjXJPHF5MTosQJUeKEKHFClDghSpwQZZUSs/eqZJ7nUz7Lz5mcECVOiBInRIkTosQJUeKEKHFC1NjYqzmfBPtbPSdockKUOCFKnBAlTogSJ0SJE6LECVHOc17M1plKZy7fh8kJUeKEKHFClDghSpwQJU6IEidEOc8J53OeE65EnBAlTogSJ0SJE6LECVHihChxQpQ4IUqcECVOiBInRIkTosQJUeKEKHFClDghSpwQJU6IEidEiROixAlR4oQocUKUOCFKnBAlTogSJ0SJE6LECVG3jeerV5MB+zM5IUqcECVOiBInRIkTosQJUZ8VcUzDwD2AfQAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"plot_digit(cv(2)-cv(1))"
]
},
{
"cell_type": "code",
"execution_count": 145,
"id": "2c7323b6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAOcAAADnCAYAAADl9EEgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAAADlUlEQVR4nO3dwWrbQBhG0ar0/V9ZWWURIjzU9lh3pHOW7cY4XH7Ih6Jt3/c/QM/fsz8AcEycECVOiBInRIkTov4N/t+vcmG+7egfXU6IEidEiROixAlR4oQocUKUOCFKnBAlTogSJ0SJE6LECVHihChxQpQ4IUqcECVOiBInRIkTosQJUeKEKHFClDghSpwQJU6IEidEiROixAlR4oQocULU6BWATLBth298y9t3b4T8JJcTosQJUeKEKHFClDghSpwQJU6IsnMeWHWHnG30vdhB38vlhChxQpQ4IUqcECVOiBInRIkTom65c9oxWYHLCVHihChxQpQ4IUqcECVOiFp2SrnqHPLqY1dX/V7uyOWEKHFClDghSpwQJU6IEidEiROilt05y/yJSN7B5YQocUKUOCFKnBAlTogSJ0SJE6LsnE+wY/IJLidEiROixAlR4oQocUKUOCFKnBC17M452hof/f1WOyUrcDkhSpwQJU6IEidEiROixAlR4oSoZXfOkVW3zPL7NVf9TlflckKUOCFKnBAlTogSJ0SJE6IuO6WUleeSR1793KaY/+NyQpQ4IUqcECVOiBInRIkTosQJUXbOCVbdMWcbfS920J9cTogSJ0SJE6LECVHihChxQpQ4IWobbEuGpwlm7qCvvBpxZYtvpIc/FJcTosQJUeKEKHFClDghSpwQJU6I8jznYl7d82bugVfdUM/ickKUOCFKnBAlTogSJ0SJE6LECVF2zhMs/uwhH+JyQpQ4IUqcECVOiBInRIkTokwpvM1d/yznLC4nRIkTosQJUeKEKHFClDghSpwQZed8wpl7ncfNjo1+Jit+by4nRIkTosQJUeKEKHFClDghSpwQJU6IEidEiROixAlR4oQocUKUOCFKnBDlec7FlJ9b9Jzre7mcECVOiBInRIkTosQJUeKEKFPKE8qvuvOavetwOSFKnBAlTogSJ0SJE6LECVHihCg75wTlHXRVV3wkbMTlhChxQpQ4IUqcECVOiBInRIkTouycJ3i02d15A73jlvmIywlR4oQocUKUOCFKnBAlTogSJ0TZOWNsfXxzOSFKnBAlTogSJ0SJE6LECVHihChxQpQ4IUqcECVOiBInRIkTosQJUeKEKHFClDghSpwQJU6IEidEiROixAlR4oQocUKUOCFKnBAlTogSJ0SJE6LECVGjVwBuH/kUwC8uJ0SJE6LECVHihChxQpQ4IeoLGL5a6fFroA8AAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"a = cv(3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "87a073e1",
"id": "b608bd89",
"metadata": {},
"outputs": [],
"source": []

View File

@ -0,0 +1,25 @@
,mean_fit_time,std_fit_time,mean_score_time,std_score_time,param_metric,param_n_neighbors,param_weights,params,split0_test_score,split1_test_score,split2_test_score,mean_test_score,std_test_score,rank_test_score
1,0.6206035614013672,0.09060096919428257,1070.8031173547108,58.40420733215167,euclidean,3,distance,"{'metric': 'euclidean', 'n_neighbors': 3, 'weights': 'distance'}",0.9682862806021321,0.970589810896234,0.9706953819779278,0.9698571578254312,0.001111613767256926,1
0,0.3251535892486572,0.127680187632828,1156.720083475113,103.6800414474859,euclidean,3,uniform,"{'metric': 'euclidean', 'n_neighbors': 3, 'weights': 'uniform'}",0.9673755825788826,0.968714844377779,0.9698917818493518,0.9686607362686711,0.0010279463208361468,2
3,0.581209659576416,0.10390654521562699,1097.628236611684,49.50409271683481,euclidean,5,distance,"{'metric': 'euclidean', 'n_neighbors': 5, 'weights': 'distance'}",0.9670541597471474,0.9677505758825735,0.9693024750883961,0.968035736906039,0.0009397581516544441,3
5,0.3833950360616048,0.09814461155343633,1019.8115065892538,49.683140897762506,euclidean,7,distance,"{'metric': 'euclidean', 'n_neighbors': 7, 'weights': 'distance'}",0.9656077570043392,0.9673755825788826,0.9683917282760098,0.9671250226197438,0.0011502780041406022,4
2,0.5214482148488363,0.1338813546209848,1234.2422309716542,11.319769031350406,euclidean,5,uniform,"{'metric': 'euclidean', 'n_neighbors': 5, 'weights': 'uniform'}",0.9659291798360744,0.9661970321958536,0.9679095681988642,0.9666785934102641,0.0008772724469576776,5
4,0.38950196901957196,0.10594237544622603,1119.6926170190175,64.25975988670193,euclidean,7,uniform,"{'metric': 'euclidean', 'n_neighbors': 7, 'weights': 'uniform'}",0.9643756361493545,0.9659827503080303,0.9674809814636237,0.9659464559736696,0.0012680116558989624,6
7,0.44870662689208984,0.1539214539086042,1095.8349254131317,95.22915205238016,euclidean,11,distance,"{'metric': 'euclidean', 'n_neighbors': 11, 'weights': 'distance'}",0.9646434885091337,0.9632506562382814,0.9647487410264652,0.9642142952579601,0.0006827491697964685,7
6,0.6263217926025391,0.045471428070326544,1231.947474082311,10.357145120994318,euclidean,11,uniform,"{'metric': 'euclidean', 'n_neighbors': 11, 'weights': 'uniform'}",0.9637327904858842,0.961911394439385,0.9634094074788385,0.9630178641347026,0.000793452595644972,8
9,0.6597681840260824,0.08367258300110442,1603.911631822586,11.793869730582724,manhattan,3,distance,"{'metric': 'manhattan', 'n_neighbors': 3, 'weights': 'distance'}",0.961161407832003,0.9625006696308994,0.9638915675559842,0.9625178816729623,0.0011146494876286455,9
11,0.743593692779541,0.12585558461284738,1623.6791274547577,20.225285349079297,manhattan,5,distance,"{'metric': 'manhattan', 'n_neighbors': 5, 'weights': 'distance'}",0.9598757165050624,0.9628220924626346,0.9633558341369335,0.9620178810348768,0.001530331488777754,10
8,0.5049304962158203,0.03915105846837655,1631.9402144749959,11.72758222926691,manhattan,3,uniform,"{'metric': 'manhattan', 'n_neighbors': 3, 'weights': 'uniform'}",0.9600899983928859,0.9608935554722237,0.9630343940855031,0.9613393159835374,0.0012426834737134394,11
13,0.7563843727111816,0.0361495198811297,1650.8071510791779,2.759115546096175,manhattan,7,distance,"{'metric': 'manhattan', 'n_neighbors': 7, 'weights': 'distance'}",0.9593935822574597,0.9614828306637382,0.9609986070931105,0.9606250066714361,0.0008929063713852963,12
10,0.5714000860850016,0.200821086554179,1670.9476985931396,21.43965257048912,manhattan,5,uniform,"{'metric': 'manhattan', 'n_neighbors': 5, 'weights': 'uniform'}",0.9581078909305191,0.9610006964161354,0.9616950605378763,0.9602678826281769,0.0015534281409951467,13
12,0.7014182408650717,0.07630416360771637,1602.6147842407227,13.998164063202559,manhattan,7,uniform,"{'metric': 'manhattan', 'n_neighbors': 7, 'weights': 'uniform'}",0.9576793271548723,0.9597150050891948,0.9595521268616737,0.9589821530352469,0.0009236336882771337,14
15,0.5463813940684,0.20986627389723325,1621.221689303716,10.57220404161948,manhattan,11,distance,"{'metric': 'manhattan', 'n_neighbors': 11, 'weights': 'distance'}",0.9573043338511812,0.957036481491402,0.9578913532626165,0.9574107228683998,0.00035701578260487497,15
14,0.659561554590861,0.16166694480866448,1647.0242857138317,15.482865038769452,manhattan,11,uniform,"{'metric': 'manhattan', 'n_neighbors': 11, 'weights': 'uniform'}",0.9554829378046821,0.9555900787485938,0.9565520197149898,0.9558750120894218,0.00048071078572838955,16
19,5.247008244196574,3.982239002878492,1610.0853408177693,4.880005667545898,chebyshev,5,distance,"{'metric': 'chebyshev', 'n_neighbors': 5, 'weights': 'distance'}",0.798253602614239,0.8040392135854717,0.8051001821493625,0.8024643327830244,0.003008776051168824,17
21,20.442909558614094,10.268306972202161,1091.167144536972,373.74252764500056,chebyshev,7,distance,"{'metric': 'chebyshev', 'n_neighbors': 7, 'weights': 'distance'}",0.7973429045909894,0.8016285423474581,0.7997964213007608,0.7995892894130695,0.0017557240593918855,18
17,3.0204404989878335,3.242756624385942,1615.3644462426503,47.3978612160567,chebyshev,3,distance,"{'metric': 'chebyshev', 'n_neighbors': 3, 'weights': 'distance'}",0.7828788771629078,0.80393207264156,0.8089038894246223,0.7985716130763634,0.011280549953147328,19
23,27.638134558995564,4.867014100523201,734.1344640254974,31.858155565000086,chebyshev,11,distance,"{'metric': 'chebyshev', 'n_neighbors': 11, 'weights': 'distance'}",0.7919858573954036,0.7913965822038892,0.7912782599378549,0.7915535665123826,0.00030946900255889454,20
18,1.1796804269154866,0.7346351248980267,1684.378450314204,9.234898911008068,chebyshev,5,uniform,"{'metric': 'chebyshev', 'n_neighbors': 5, 'weights': 'uniform'}",0.783575293298334,0.7888251995500081,0.7891353262616522,0.7871786063699981,0.0025510708161656103,21
20,0.49048900604248047,0.05161896574410176,1679.1593386332195,1.1331046631334827,chebyshev,7,uniform,"{'metric': 'chebyshev', 'n_neighbors': 7, 'weights': 'uniform'}",0.7845395617935395,0.7868966625595971,0.7855994856959178,0.7856785700163514,0.0009639058573122337,22
16,0.6336509386698405,0.19319871048710188,1672.988091468811,6.364915306048909,chebyshev,3,uniform,"{'metric': 'chebyshev', 'n_neighbors': 3, 'weights': 'uniform'}",0.7702898162532812,0.7848074141533187,0.7878495660559306,0.7809822654875102,0.007662028670422474,23
22,21.680665890375774,3.469126600885206,794.0563353697459,13.966075572059058,chebyshev,11,uniform,"{'metric': 'chebyshev', 'n_neighbors': 11, 'weights': 'uniform'}",0.78052177639685,0.7794503669577328,0.7796528447444552,0.7798749960330128,0.0004647529399678837,24
1 mean_fit_time std_fit_time mean_score_time std_score_time param_metric param_n_neighbors param_weights params split0_test_score split1_test_score split2_test_score mean_test_score std_test_score rank_test_score
2 1 0.6206035614013672 0.09060096919428257 1070.8031173547108 58.40420733215167 euclidean 3 distance {'metric': 'euclidean', 'n_neighbors': 3, 'weights': 'distance'} 0.9682862806021321 0.970589810896234 0.9706953819779278 0.9698571578254312 0.001111613767256926 1
3 0 0.3251535892486572 0.127680187632828 1156.720083475113 103.6800414474859 euclidean 3 uniform {'metric': 'euclidean', 'n_neighbors': 3, 'weights': 'uniform'} 0.9673755825788826 0.968714844377779 0.9698917818493518 0.9686607362686711 0.0010279463208361468 2
4 3 0.581209659576416 0.10390654521562699 1097.628236611684 49.50409271683481 euclidean 5 distance {'metric': 'euclidean', 'n_neighbors': 5, 'weights': 'distance'} 0.9670541597471474 0.9677505758825735 0.9693024750883961 0.968035736906039 0.0009397581516544441 3
5 5 0.3833950360616048 0.09814461155343633 1019.8115065892538 49.683140897762506 euclidean 7 distance {'metric': 'euclidean', 'n_neighbors': 7, 'weights': 'distance'} 0.9656077570043392 0.9673755825788826 0.9683917282760098 0.9671250226197438 0.0011502780041406022 4
6 2 0.5214482148488363 0.1338813546209848 1234.2422309716542 11.319769031350406 euclidean 5 uniform {'metric': 'euclidean', 'n_neighbors': 5, 'weights': 'uniform'} 0.9659291798360744 0.9661970321958536 0.9679095681988642 0.9666785934102641 0.0008772724469576776 5
7 4 0.38950196901957196 0.10594237544622603 1119.6926170190175 64.25975988670193 euclidean 7 uniform {'metric': 'euclidean', 'n_neighbors': 7, 'weights': 'uniform'} 0.9643756361493545 0.9659827503080303 0.9674809814636237 0.9659464559736696 0.0012680116558989624 6
8 7 0.44870662689208984 0.1539214539086042 1095.8349254131317 95.22915205238016 euclidean 11 distance {'metric': 'euclidean', 'n_neighbors': 11, 'weights': 'distance'} 0.9646434885091337 0.9632506562382814 0.9647487410264652 0.9642142952579601 0.0006827491697964685 7
9 6 0.6263217926025391 0.045471428070326544 1231.947474082311 10.357145120994318 euclidean 11 uniform {'metric': 'euclidean', 'n_neighbors': 11, 'weights': 'uniform'} 0.9637327904858842 0.961911394439385 0.9634094074788385 0.9630178641347026 0.000793452595644972 8
10 9 0.6597681840260824 0.08367258300110442 1603.911631822586 11.793869730582724 manhattan 3 distance {'metric': 'manhattan', 'n_neighbors': 3, 'weights': 'distance'} 0.961161407832003 0.9625006696308994 0.9638915675559842 0.9625178816729623 0.0011146494876286455 9
11 11 0.743593692779541 0.12585558461284738 1623.6791274547577 20.225285349079297 manhattan 5 distance {'metric': 'manhattan', 'n_neighbors': 5, 'weights': 'distance'} 0.9598757165050624 0.9628220924626346 0.9633558341369335 0.9620178810348768 0.001530331488777754 10
12 8 0.5049304962158203 0.03915105846837655 1631.9402144749959 11.72758222926691 manhattan 3 uniform {'metric': 'manhattan', 'n_neighbors': 3, 'weights': 'uniform'} 0.9600899983928859 0.9608935554722237 0.9630343940855031 0.9613393159835374 0.0012426834737134394 11
13 13 0.7563843727111816 0.0361495198811297 1650.8071510791779 2.759115546096175 manhattan 7 distance {'metric': 'manhattan', 'n_neighbors': 7, 'weights': 'distance'} 0.9593935822574597 0.9614828306637382 0.9609986070931105 0.9606250066714361 0.0008929063713852963 12
14 10 0.5714000860850016 0.200821086554179 1670.9476985931396 21.43965257048912 manhattan 5 uniform {'metric': 'manhattan', 'n_neighbors': 5, 'weights': 'uniform'} 0.9581078909305191 0.9610006964161354 0.9616950605378763 0.9602678826281769 0.0015534281409951467 13
15 12 0.7014182408650717 0.07630416360771637 1602.6147842407227 13.998164063202559 manhattan 7 uniform {'metric': 'manhattan', 'n_neighbors': 7, 'weights': 'uniform'} 0.9576793271548723 0.9597150050891948 0.9595521268616737 0.9589821530352469 0.0009236336882771337 14
16 15 0.5463813940684 0.20986627389723325 1621.221689303716 10.57220404161948 manhattan 11 distance {'metric': 'manhattan', 'n_neighbors': 11, 'weights': 'distance'} 0.9573043338511812 0.957036481491402 0.9578913532626165 0.9574107228683998 0.00035701578260487497 15
17 14 0.659561554590861 0.16166694480866448 1647.0242857138317 15.482865038769452 manhattan 11 uniform {'metric': 'manhattan', 'n_neighbors': 11, 'weights': 'uniform'} 0.9554829378046821 0.9555900787485938 0.9565520197149898 0.9558750120894218 0.00048071078572838955 16
18 19 5.247008244196574 3.982239002878492 1610.0853408177693 4.880005667545898 chebyshev 5 distance {'metric': 'chebyshev', 'n_neighbors': 5, 'weights': 'distance'} 0.798253602614239 0.8040392135854717 0.8051001821493625 0.8024643327830244 0.003008776051168824 17
19 21 20.442909558614094 10.268306972202161 1091.167144536972 373.74252764500056 chebyshev 7 distance {'metric': 'chebyshev', 'n_neighbors': 7, 'weights': 'distance'} 0.7973429045909894 0.8016285423474581 0.7997964213007608 0.7995892894130695 0.0017557240593918855 18
20 17 3.0204404989878335 3.242756624385942 1615.3644462426503 47.3978612160567 chebyshev 3 distance {'metric': 'chebyshev', 'n_neighbors': 3, 'weights': 'distance'} 0.7828788771629078 0.80393207264156 0.8089038894246223 0.7985716130763634 0.011280549953147328 19
21 23 27.638134558995564 4.867014100523201 734.1344640254974 31.858155565000086 chebyshev 11 distance {'metric': 'chebyshev', 'n_neighbors': 11, 'weights': 'distance'} 0.7919858573954036 0.7913965822038892 0.7912782599378549 0.7915535665123826 0.00030946900255889454 20
22 18 1.1796804269154866 0.7346351248980267 1684.378450314204 9.234898911008068 chebyshev 5 uniform {'metric': 'chebyshev', 'n_neighbors': 5, 'weights': 'uniform'} 0.783575293298334 0.7888251995500081 0.7891353262616522 0.7871786063699981 0.0025510708161656103 21
23 20 0.49048900604248047 0.05161896574410176 1679.1593386332195 1.1331046631334827 chebyshev 7 uniform {'metric': 'chebyshev', 'n_neighbors': 7, 'weights': 'uniform'} 0.7845395617935395 0.7868966625595971 0.7855994856959178 0.7856785700163514 0.0009639058573122337 22
24 16 0.6336509386698405 0.19319871048710188 1672.988091468811 6.364915306048909 chebyshev 3 uniform {'metric': 'chebyshev', 'n_neighbors': 3, 'weights': 'uniform'} 0.7702898162532812 0.7848074141533187 0.7878495660559306 0.7809822654875102 0.007662028670422474 23
25 22 21.680665890375774 3.469126600885206 794.0563353697459 13.966075572059058 chebyshev 11 uniform {'metric': 'chebyshev', 'n_neighbors': 11, 'weights': 'uniform'} 0.78052177639685 0.7794503669577328 0.7796528447444552 0.7798749960330128 0.0004647529399678837 24

View File

@ -0,0 +1,25 @@
,rank_test_score,mean_fit_time,param_n_neighbors,param_metric,param_weights,mean_test_score
1,1,0.6206035614013672,3,euclidean,distance,0.9698571578254312
0,2,0.3251535892486572,3,euclidean,uniform,0.9686607362686711
3,3,0.581209659576416,5,euclidean,distance,0.968035736906039
5,4,0.3833950360616048,7,euclidean,distance,0.9671250226197438
2,5,0.5214482148488363,5,euclidean,uniform,0.9666785934102641
4,6,0.38950196901957196,7,euclidean,uniform,0.9659464559736696
7,7,0.44870662689208984,11,euclidean,distance,0.9642142952579601
6,8,0.6263217926025391,11,euclidean,uniform,0.9630178641347026
9,9,0.6597681840260824,3,manhattan,distance,0.9625178816729623
11,10,0.743593692779541,5,manhattan,distance,0.9620178810348768
8,11,0.5049304962158203,3,manhattan,uniform,0.9613393159835374
13,12,0.7563843727111816,7,manhattan,distance,0.9606250066714361
10,13,0.5714000860850016,5,manhattan,uniform,0.9602678826281769
12,14,0.7014182408650717,7,manhattan,uniform,0.9589821530352469
15,15,0.5463813940684,11,manhattan,distance,0.9574107228683998
14,16,0.659561554590861,11,manhattan,uniform,0.9558750120894218
19,17,5.247008244196574,5,chebyshev,distance,0.8024643327830244
21,18,20.442909558614094,7,chebyshev,distance,0.7995892894130695
17,19,3.0204404989878335,3,chebyshev,distance,0.7985716130763634
23,20,27.638134558995564,11,chebyshev,distance,0.7915535665123826
18,21,1.1796804269154866,5,chebyshev,uniform,0.7871786063699981
20,22,0.49048900604248047,7,chebyshev,uniform,0.7856785700163514
16,23,0.6336509386698405,3,chebyshev,uniform,0.7809822654875102
22,24,21.680665890375774,11,chebyshev,uniform,0.7798749960330128
1 rank_test_score mean_fit_time param_n_neighbors param_metric param_weights mean_test_score
2 1 1 0.6206035614013672 3 euclidean distance 0.9698571578254312
3 0 2 0.3251535892486572 3 euclidean uniform 0.9686607362686711
4 3 3 0.581209659576416 5 euclidean distance 0.968035736906039
5 5 4 0.3833950360616048 7 euclidean distance 0.9671250226197438
6 2 5 0.5214482148488363 5 euclidean uniform 0.9666785934102641
7 4 6 0.38950196901957196 7 euclidean uniform 0.9659464559736696
8 7 7 0.44870662689208984 11 euclidean distance 0.9642142952579601
9 6 8 0.6263217926025391 11 euclidean uniform 0.9630178641347026
10 9 9 0.6597681840260824 3 manhattan distance 0.9625178816729623
11 11 10 0.743593692779541 5 manhattan distance 0.9620178810348768
12 8 11 0.5049304962158203 3 manhattan uniform 0.9613393159835374
13 13 12 0.7563843727111816 7 manhattan distance 0.9606250066714361
14 10 13 0.5714000860850016 5 manhattan uniform 0.9602678826281769
15 12 14 0.7014182408650717 7 manhattan uniform 0.9589821530352469
16 15 15 0.5463813940684 11 manhattan distance 0.9574107228683998
17 14 16 0.659561554590861 11 manhattan uniform 0.9558750120894218
18 19 17 5.247008244196574 5 chebyshev distance 0.8024643327830244
19 21 18 20.442909558614094 7 chebyshev distance 0.7995892894130695
20 17 19 3.0204404989878335 3 chebyshev distance 0.7985716130763634
21 23 20 27.638134558995564 11 chebyshev distance 0.7915535665123826
22 18 21 1.1796804269154866 5 chebyshev uniform 0.7871786063699981
23 20 22 0.49048900604248047 7 chebyshev uniform 0.7856785700163514
24 16 23 0.6336509386698405 3 chebyshev uniform 0.7809822654875102
25 22 24 21.680665890375774 11 chebyshev uniform 0.7798749960330128