From 9e7910d1e688c6e4da90db30b2aed057e1ed4018 Mon Sep 17 00:00:00 2001 From: Favour James <63251266+Favourj-bit@users.noreply.github.com> Date: Sat, 17 Jul 2021 21:22:30 +0100 Subject: [PATCH 1/4] knn code --- .vscode/settings.json | 3 + James, Favour Utibe/README.md | 24 + .../__pycache__/code.cpython-37.pyc | Bin 0 -> 197 bytes .../__pycache__/code.cpython-39.pyc | Bin 0 -> 1592 bytes .../__pycache__/knn_code.cpython-37.pyc | Bin 0 -> 2828 bytes .../__pycache__/knn_code1.cpython-37.pyc | Bin 0 -> 1538 bytes .../Algorithm_challenge-checkpoint.ipynb | 6 + ...orithm_challenge_notebook-checkpoint.ipynb | 982 ++++++++++++++++++ .../Algorithm_challenge_notebook.ipynb | 982 ++++++++++++++++++ .../my_python_package/__init__.py | 1 + .../__pycache__/__init__.cpython-39.pyc | Bin 0 -> 178 bytes .../__pycache__/knn_code.cpython-37.pyc | Bin 0 -> 1707 bytes .../__pycache__/knn_code1.cpython-37.pyc | Bin 0 -> 1675 bytes .../__pycache__/knn_code1.cpython-39.pyc | Bin 0 -> 1716 bytes .../breast-cancer-wisconsin.csv | 700 +++++++++++++ .../breast-cancer-wisconsin.names | 126 +++ .../my_python_package/knn_code.py | 43 + James, Favour Utibe/setup.py | 10 + README.md | 40 - breast-cancer-wisconsin.csv | 700 +++++++++++++ 20 files changed, 3577 insertions(+), 40 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 James, Favour Utibe/README.md create mode 100644 James, Favour Utibe/__pycache__/code.cpython-37.pyc create mode 100644 James, Favour Utibe/__pycache__/code.cpython-39.pyc create mode 100644 James, Favour Utibe/__pycache__/knn_code.cpython-37.pyc create mode 100644 James, Favour Utibe/__pycache__/knn_code1.cpython-37.pyc create mode 100644 James, Favour Utibe/my_python_package/.ipynb_checkpoints/Algorithm_challenge-checkpoint.ipynb create mode 100644 James, Favour Utibe/my_python_package/.ipynb_checkpoints/Algorithm_challenge_notebook-checkpoint.ipynb create mode 100644 James, Favour Utibe/my_python_package/Algorithm_challenge_notebook.ipynb create mode 100644 James, Favour Utibe/my_python_package/__init__.py create mode 100644 James, Favour Utibe/my_python_package/__pycache__/__init__.cpython-39.pyc create mode 100644 James, Favour Utibe/my_python_package/__pycache__/knn_code.cpython-37.pyc create mode 100644 James, Favour Utibe/my_python_package/__pycache__/knn_code1.cpython-37.pyc create mode 100644 James, Favour Utibe/my_python_package/__pycache__/knn_code1.cpython-39.pyc create mode 100644 James, Favour Utibe/my_python_package/breast-cancer-wisconsin.csv create mode 100644 James, Favour Utibe/my_python_package/breast-cancer-wisconsin.names create mode 100644 James, Favour Utibe/my_python_package/knn_code.py create mode 100644 James, Favour Utibe/setup.py delete mode 100644 README.md create mode 100644 breast-cancer-wisconsin.csv diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c78e8fa --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "C:\\Users\\FAVOUR JAMES\\anaconda3\\python.exe" +} \ No newline at end of file diff --git a/James, Favour Utibe/README.md b/James, Favour Utibe/README.md new file mode 100644 index 0000000..53e08fa --- /dev/null +++ b/James, Favour Utibe/README.md @@ -0,0 +1,24 @@ +# ML-Algorithm-Challenge + +KNN stands for K-Nearest Neighbors. The k-nearest neighbors algorithm uses a very simple approach to perform classification. When tested with a new example, it looks through the training data and finds the k training examples that are closest to the new example. It then assigns the most common class label (among those k-training examples) to the test example. +k in the kNN algorithm represents the number of nearest neighbor points which are voting for the new test data’s class. +If k=1, then test examples are given the same label as the closest example in the training set. If k=3, the labels of the three closest classes are checked and the most common (i.e., occurring at least twice) label is assigned, and so on for larger ks. +To calculate the distance between the points, different types of distance metrics can be used such as euclidean distance, cosine distance, and so on, though the euclidean distance is most widely used because it still functions better on most datasets and that is what is used in the sklearn module. + +How the algorithm functions +In this algorithm, I made use of the euclidean distance. Euclidean distance is just a straight-line distance between two data points in Euclidean space[1]. It can be calculated as follows: +d(x,y) = ((x1 - y1)² + (x2 - y2)² + ... + (xn - yn)²)½ +But this way of calculating distance accounts for only 2-dimensional points, in the case of 3-dimensional points, it won't function well. In my code, I made use of the numpy method of calculating distances and this also accounts for 3-dimensional points. + +Algorithm Implementation + k: value for k +train_set: entire list with values for training the algorithm +test_set: entire list with values for testing the algorithm + +Steps to follow: +1. Calculate Euclidean distance between the test_instanceand each row of the train_set +2. Sort the distances by distance value, from lowest to highest +3. Keep the distance of the smallest ones +4. Get values of a target variable for k train_set rows with the smallest distance +5. Whichever target variable class has the majority, wins + diff --git a/James, Favour Utibe/__pycache__/code.cpython-37.pyc b/James, Favour Utibe/__pycache__/code.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4828d0bd081a5ecf3aba65aa15879994fd32ebc1 GIT binary patch literal 197 zcmZ?b<>g`kg6`<&39>-?F^B^LOhASM5EqL8iByIZhGs@ah7`sWrX0p7AQ{Y{$sEO+ zk(!f}{}QNx!B3Ov7HdIKW?o4YYhGz?LFGz@B4(gCnE2)DY!wq)oLW>I>1g9OIIoT$-DjS5h3~o>}5iniS*fqwAQHo?nz%l98+HoROH5lbV;F8k3x#lB!ow Xd5gm)H$SB`C)JJ-XmT;gg&d3kNZ-1)?yjn@did;Yo8ajD`ujJ} zT|#~_i+>Iu7at?3j1nSXRELbt75)KdSrYBB`W5P z-Q0HkGxYxUS@~a|-vnW6NLOJ6eYe>9LwIC8qw)@{ ziJ1>^A6#wt)o1khU8FU*E*1f`SID`A+0y%@zdSKW-0RcY-_6TRgPho?h|KhAv``3; zc9GOGoHVJh29%1fG#EkR8_F&WvFiEL}+RHSmIQI1?~A39^4$6n=L(1xS`Wvs!- ztL(8~d6g4eO-0^2UKf_IpAa2X_Br-IWtnQ-!rMl^ZdLv{9k+#ZL515RhDJdZU>4rJ zvk#8KM1=};sPmAACp;}7OhKtoAMgy7ny2AOu9GYdW0{wQx*kT@Z?A`il7n;~NiE|P zW0ntRMzq2>dgMFn*uk6V#O!%a`c`dizF*TsVn>r^dU1RA#@+)3Qtf@R^Ys@Gz6?L# zxqJKm-mN?;hmdKt_i3U(D#MtlDHXd9DkGae+YgIc& zs;#VGUYcY)jhU0>a>!gRB|oh_UKEgt+EcmIAfzcs-5KV1B?dFhvwo{~1lOGTg#?jA zx~500CGcvVMWAZ8sVfWif$I`OWs6WoX(E7UgI8Y6MGVl?F>HWNWvbtlP?|QYm;NJH zV`xwzbcVL6Lj&Y%bkSO+mn^x0*0U>*BygoSA`^|=c$}yx&s36aM(X4Ry_xXSKVN>; zr_4{XBIOa(Rw9~m#Xo#+#!ol<*2E+|F*TgL#4$18_NiPl=eKsEsFXZ9y@49@KKgGn zH!Fw5shq^`}w; zUa&RHMVZ33=|S}oP61+N&lx?a;Re&zd6(gbiw)yf7+cR literal 0 HcmV?d00001 diff --git a/James, Favour Utibe/__pycache__/knn_code.cpython-37.pyc b/James, Favour Utibe/__pycache__/knn_code.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7f558352117d0c44718c7792b9257563f4baeade GIT binary patch literal 2828 zcmb7G&vP6{74Gi&v9qgPX)PUvt3+4ivXs!uNV5B{(Xon62)9)APFL_4nTQ z&A#91v>2|R{_|hI|MLQ4pV7_5<-vFlt-Q?{lT7lAh1`xJbnNJcE=G}g13&cn+@}#X zo-pZ1_Y)>v6`VR@^S{>2_wcgTU?E%>w8J)Ms(s4Bj_MpNhD*vh=)$^&wk-WKfqCcP zxnyyb)~DZ4H`J|}2yd&K({HNVGtSx3-=8tXr<-bR z#^K9974q6X`F{)k-&WsIH)r%#{*?8WUlM9NJ#HEgi&0)FozTR^C1AXVR(>CyvJiv< zTMC5h%)tVbp7e3=(E%~~vWbmb=K5ijt5~bD!kG4-?-jaCXhXVar1lW4q*T_tW)U)h zrJTayhdp83Qf2$v#pAy)?PK`-gNN_zepD)5?mm9-+h2Y3>&;(0`0!^>cOMnWXrS_{ z+x!VaE*ujFo^(-#1!y+<9T<{Nobh(WDqizbz_Z3qIkI(k;?_NA@6YG+1Sad$LI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code1.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..523274f72436dda2ea47b5e44997f820f7a8c4e8 GIT binary patch literal 1538 zcmaJ>&2Jnv6t_K|*~#WZ6;xHDRA@jPSfnmR96(VNC8V@fMT10CB8|2hoUyx^?0m)c zlw>t~+VBT(=a3xvKlm$rLgLgD;@T7MO}eP63LZT_``LaUzxUpJy}H^bF#h=K?;n5X zg#3w{#ehB80WvsAB56)y+Hn?p9p^Cz&T_v9;(%V?>BYT=M0%265Xn_I_u?f<56HlO z30lbhfV$pZ)s$B06a|aHV6g*aK88tkhGHhEWETXCb?U&FF9X>7vIh!7_x>a)mC(vq z;Mw^2sM01yML3Wn?Ex7KvZXCaz(;sW(G5BoFvpF`pKFZtH=+YzuO9Dhj-DE&&FI1I z58plgK6h3Y?6fNMCTcu-g$@D!^OqagPS;(fbdo4{;#mG5WpNlIH40?-?r@1lk|#G zGA1+c>`_balV>|Kezpl=@^u2c;mo)E#J>zIzwEXC740~?qPNKvodvCT8MZ;o#~`8P z^xh#k{pb*qDZL9~ms)QQsYYu*Gt@Sxv!3m@y*a&Hmi&rJf1M!B!ZrjzgZ=3jlPEKh zQ8uzwB%&80Z&Z{kVnm%<9iEfg^{3YZsVs*LkHh+Ozw3EM!0$M2~o z%`>S)nJjL_KEMe_%g7SA)a3RpI9%^_jLTrF1D4P=+NT_7jozWR7}9j(f6)22q0n9I zkgg&hz(Ud)JNpXi5-XEI#eF(rGjGOQujLb_KWUj{Uy>QKRC+D5tc5DtAae%QcH@wM z#M{7TgURr6b zQX6|BwT`3gZ74$VTJ<_;GAl3kHwdJP53 yX$8NS)Miy_uFEOVaHT3-P#vAXL8s*nYn^el" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEGCAYAAABiq/5QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcm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XGLX5Jaozhl6TGGH5Jaozhl6TGGH5Jaozhl/YhyaeS/N7Qc0j7i+GXpMYYfmmOJB9J8mCSB5J8Y87PPprknu5n1yd5e7f+nCQPd+tv79admOTu7g1CDyZZMcTvI83lG7ikWZKcCNwArKyqHUkOB34beLmqvpTkiKp6trvuZ4FnquqyJA8BZ1TVvyc5tKpeSHIZ8E9VdXV3Wo5FVfWjoX43aRe3+KXdrQKuq6odAFU195z770ny913ozwdO7NbfAVyZ5KPAom7dncAnknwceKfR15uF4Zd2F/Z+euwrgYuq6r3Ap4GDAKrqN4E/YnTG1fu7fxl8EzgT+BHw3SSr+hxcGpfhl3a3ETg3yREA3a6e2Q4Gtnan9T1/18ok76qqu6rqk8AO4JgkPwU8UVV/zujMq++byG8g7cPioQeQ3kyq6pEknwO+l+QV4D7gyVlX+WNGn9b0A+AhRk8EAF/sXrwNoyePB4BLgQuS/DfwQ+AzE/klpH3wxV1Jaoy7eiSpMYZfkhpj+CWpMYZfkhpj+CWpMYZfkhpj+CWpMf8LnIhAESg5FuoAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "#checking target distribution\n", + "sns.countplot(data = df, x = 'class')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# This dataset has 3 different classes" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(sepal length (cm),) False\n", + "(sepal width (cm),) False\n", + "(petal length (cm),) False\n", + "(petal width (cm),) False\n", + "class False\n", + "dtype: bool" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.isnull().any()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "From this, we can observe that the dataset has no missing values, so we are good to go." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
(sepal length (cm),)(sepal width (cm),)(petal length (cm),)(petal width (cm),)class
count150.000000150.000000150.000000150.000000150.000000
mean5.8433333.0573333.7580001.1993331.000000
std0.8280660.4358661.7652980.7622380.819232
min4.3000002.0000001.0000000.1000000.000000
25%5.1000002.8000001.6000000.3000000.000000
50%5.8000003.0000004.3500001.3000001.000000
75%6.4000003.3000005.1000001.8000002.000000
max7.9000004.4000006.9000002.5000002.000000
\n", + "
" + ], + "text/plain": [ + " (sepal length (cm),) (sepal width (cm),) (petal length (cm),) \\\n", + "count 150.000000 150.000000 150.000000 \n", + "mean 5.843333 3.057333 3.758000 \n", + "std 0.828066 0.435866 1.765298 \n", + "min 4.300000 2.000000 1.000000 \n", + "25% 5.100000 2.800000 1.600000 \n", + "50% 5.800000 3.000000 4.350000 \n", + "75% 6.400000 3.300000 5.100000 \n", + "max 7.900000 4.400000 6.900000 \n", + "\n", + " (petal width (cm),) class \n", + "count 150.000000 150.000000 \n", + "mean 1.199333 1.000000 \n", + "std 0.762238 0.819232 \n", + "min 0.100000 0.000000 \n", + "25% 0.300000 0.000000 \n", + "50% 1.300000 1.000000 \n", + "75% 1.800000 2.000000 \n", + "max 2.500000 2.000000 " + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.describe()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "full_data = df.astype(float).values.tolist()\n", + "random.shuffle(full_data)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "#dividing into train and test sets\n", + "test_size = 0.2\n", + "train_set ={0:[], 1:[], 2:[]}\n", + "test_set ={0:[], 1:[], 2:[]}\n", + "train_data = full_data[:-int(test_size*len(full_data))]\n", + "test_data = full_data[-int(test_size*len(full_data)):]\n", + "for i in train_data:\n", + " train_set[i[-1]].append(i[:-1])\n", + "for i in test_data:\n", + " test_set[i[-1]].append(i[:-1])" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(3, 3)" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(train_set), len(test_set)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Accuracy: 1.0\n" + ] + } + ], + "source": [ + "#perform prediction using the knn_code1 algorithm\n", + "knn = k_nearest_neighbors(k=4) #k can be set to any value desired\n", + "preds = []\n", + "\n", + "predictions = knn.evaluate(train_set, test_set)\n", + "preds.append(predictions)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "let us set our value to 3 and observe our result" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Accuracy: 1.0\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\FAVOUR JAMES\\Documents\\GitHub\\ML-Algorithm-Challenge\\my_pckg\\knn_code1.py:14: UserWarning: k is set to a value less than total voting groups! \n", + " warnings.warn('k is set to a value less than total voting groups! ')\n" + ] + } + ], + "source": [ + "knn = k_nearest_neighbors(k=3) \n", + "preds = []\n", + "\n", + "predictions = knn.evaluate(train_set, test_set)\n", + "preds.append(predictions)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# TESTING THE ALGORITHM WITH REAL WORLD DATASET" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
idclump_thicknessunif_cell_sizeunif_cell_shapemarg_adhesionsingle_epith_cell_sizebare_nucleibland_chromnorm_nucleolimitosesclass
010000255111213112
1100294554457103212
210154253111223112
310162776881343712
410170234113213112
....................................
6947767153111321112
6958417692111211112
6968888205101037381024
69789747148643410614
69889747148854510414
\n", + "

699 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " id clump_thickness unif_cell_size unif_cell_shape marg_adhesion \\\n", + "0 1000025 5 1 1 1 \n", + "1 1002945 5 4 4 5 \n", + "2 1015425 3 1 1 1 \n", + "3 1016277 6 8 8 1 \n", + "4 1017023 4 1 1 3 \n", + ".. ... ... ... ... ... \n", + "694 776715 3 1 1 1 \n", + "695 841769 2 1 1 1 \n", + "696 888820 5 10 10 3 \n", + "697 897471 4 8 6 4 \n", + "698 897471 4 8 8 5 \n", + "\n", + " single_epith_cell_size bare_nuclei bland_chrom norm_nucleoli mitoses \\\n", + "0 2 1 3 1 1 \n", + "1 7 10 3 2 1 \n", + "2 2 2 3 1 1 \n", + "3 3 4 3 7 1 \n", + "4 2 1 3 1 1 \n", + ".. ... ... ... ... ... \n", + "694 3 2 1 1 1 \n", + "695 2 1 1 1 1 \n", + "696 7 3 8 10 2 \n", + "697 3 4 10 6 1 \n", + "698 4 5 10 4 1 \n", + "\n", + " class \n", + "0 2 \n", + "1 2 \n", + "2 2 \n", + "3 2 \n", + "4 2 \n", + ".. ... \n", + "694 2 \n", + "695 2 \n", + "696 4 \n", + "697 4 \n", + "698 4 \n", + "\n", + "[699 rows x 11 columns]" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = pd.read_csv('breast-cancer-wisconsin.csv')\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "id 0\n", + "clump_thickness 0\n", + "unif_cell_size 0\n", + "unif_cell_shape 0\n", + "marg_adhesion 0\n", + "single_epith_cell_size 0\n", + "bare_nuclei 0\n", + "bland_chrom 0\n", + "norm_nucleoli 0\n", + "mitoses 0\n", + "class 0\n", + "dtype: int64" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "df.replace('?', -99999, inplace=True)\n", + "df.drop(['id'], 1, inplace=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEGCAYAAACKB4k+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAOCUlEQVR4nO3dfayedX3H8ffHFmRGkIcenWs767R/TKdT1yAZ/5iyPxCVEicGo9I5YrdEN4g6ZWbzaZpodEMlxoSIUpibGnCjIyaGIOqeRFtAEBpDR1Q6kB7kQZ0PW/W7P+5ffx7aA9xir/s67Xm/kpP7un7Xde58T1J9c92PqSokSQJ4zNgDSJKWDqMgSeqMgiSpMwqSpM4oSJK6lWMP8KtYtWpVrVu3buwxJOmQsmPHjnuqam6xY4d0FNatW8f27dvHHkOSDilJvv1Qx3z4SJLUGQVJUmcUJEmdUZAkdUZBktQZBUlSZxQkSZ1RkCR1RkGS1B3S72g+GH7vLy4dewQtQTvef/bYI0ij8EpBktQZBUlSZxQkSZ1RkCR1RkGS1BkFSVJnFCRJnVGQJHVGQZLUGQVJUmcUJEmdUZAkdUZBktQZBUlSZxQkSZ1RkCR1RkGS1BkFSVJnFCRJnVGQJHVGQZLUGQV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4DvAu+ayR8hTcEnmiVJnQ8fSZI6oyBJ6oyCJKkzCpKkzihIkjqjIEnqjIIkqft/vMY1HyEna84AAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "#checking target distribution\n", + "sns.countplot(data = df, x = 'class')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# This dataset has 2 different classes" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
clump_thicknessunif_cell_sizeunif_cell_shapemarg_adhesionsingle_epith_cell_sizebland_chromnorm_nucleolimitosesclass
count699.000000699.000000699.000000699.000000699.000000699.000000699.000000699.000000699.000000
mean4.4177403.1344783.2074392.8068673.2160233.4377682.8669531.5894132.689557
std2.8157413.0514592.9719132.8553792.2143002.4383643.0536341.7150780.951273
min1.0000001.0000001.0000001.0000001.0000001.0000001.0000001.0000002.000000
25%2.0000001.0000001.0000001.0000002.0000002.0000001.0000001.0000002.000000
50%4.0000001.0000001.0000001.0000002.0000003.0000001.0000001.0000002.000000
75%6.0000005.0000005.0000004.0000004.0000005.0000004.0000001.0000004.000000
max10.00000010.00000010.00000010.00000010.00000010.00000010.00000010.0000004.000000
\n", + "
" + ], + "text/plain": [ + " clump_thickness unif_cell_size unif_cell_shape marg_adhesion \\\n", + "count 699.000000 699.000000 699.000000 699.000000 \n", + "mean 4.417740 3.134478 3.207439 2.806867 \n", + "std 2.815741 3.051459 2.971913 2.855379 \n", + "min 1.000000 1.000000 1.000000 1.000000 \n", + "25% 2.000000 1.000000 1.000000 1.000000 \n", + "50% 4.000000 1.000000 1.000000 1.000000 \n", + "75% 6.000000 5.000000 5.000000 4.000000 \n", + "max 10.000000 10.000000 10.000000 10.000000 \n", + "\n", + " single_epith_cell_size bland_chrom norm_nucleoli mitoses \\\n", + "count 699.000000 699.000000 699.000000 699.000000 \n", + "mean 3.216023 3.437768 2.866953 1.589413 \n", + "std 2.214300 2.438364 3.053634 1.715078 \n", + "min 1.000000 1.000000 1.000000 1.000000 \n", + "25% 2.000000 2.000000 1.000000 1.000000 \n", + "50% 2.000000 3.000000 1.000000 1.000000 \n", + "75% 4.000000 5.000000 4.000000 1.000000 \n", + "max 10.000000 10.000000 10.000000 10.000000 \n", + "\n", + " class \n", + "count 699.000000 \n", + "mean 2.689557 \n", + "std 0.951273 \n", + "min 2.000000 \n", + "25% 2.000000 \n", + "50% 2.000000 \n", + "75% 4.000000 \n", + "max 4.000000 " + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.describe()" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "full_data = df.astype(float).values.tolist()\n", + "random.shuffle(full_data)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [], + "source": [ + "#dividing into train and test sets\n", + "test_size = 0.2 #test_size can be set to any value desired\n", + "train_set ={2:[], 4:[]}\n", + "test_set ={2:[], 4:[]}\n", + "train_data = full_data[:-int(test_size*len(full_data))]\n", + "test_data = full_data[-int(test_size*len(full_data)):]\n", + "for i in train_data:\n", + " train_set[i[-1]].append(i[:-1])\n", + "for i in test_data:\n", + " test_set[i[-1]].append(i[:-1])" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(2, 2)" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(train_set), len(test_set)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Accuracy: 0.9712230215827338\n" + ] + } + ], + "source": [ + "#perform prediction using the knn_code1 algorithm\n", + "knn = k_nearest_neighbors(k=4) #k can be set to any value desired\n", + "preds = []\n", + "\n", + "predictions = knn.evaluate(train_set, test_set)\n", + "preds.append(predictions)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "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.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/James, Favour Utibe/my_python_package/Algorithm_challenge_notebook.ipynb b/James, Favour Utibe/my_python_package/Algorithm_challenge_notebook.ipynb new file mode 100644 index 0000000..18a4ebb --- /dev/null +++ b/James, Favour Utibe/my_python_package/Algorithm_challenge_notebook.ipynb @@ -0,0 +1,982 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# IMPORTING THE KNN CODE PYTHON SCRIPT" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "from knn_code import k_nearest_neighbors" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "import seaborn as sns\n", + "import random\n", + "from sklearn.datasets import load_iris" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# TESTING THE ALGORITHM WITH SKLEARN DATASET" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "df = load_iris()\n", + "y_breast_cancer = df.target\n", + "df = pd.DataFrame(df.data, columns=[df.feature_names])\n", + "df = pd.concat([df, pd.Series(y_breast_cancer)], axis=1)\n", + "df.rename(columns={0: 'class'}, inplace=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEGCAYAAABiq/5QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAN30lEQVR4nO3df6zd9V3H8edrLQTnIPzoBSuFFZeGDPYD4g0Sm5hYxOCc0CxARoA1WldNZEL8NVx02eaWbNncnGR/2AijLGyD8ENwfzhJhaGIwC2/oU6QMKx0tOVHALOoxbd/nG/l9vbSHrDf8+XyeT6Sm3u+33t+vG8uPM+33/M935OqQpLUjrcNPYAkabIMvyQ1xvBLUmMMvyQ1xvBLUmMWDz3AOJYsWVLLly8fegxJWlA2bdq0o6qm5q5fEOFfvnw5MzMzQ48hSQtKkh/M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yREA3a6e2Q4Gtnan9T1/18ok76qqu6rqk8AO4JgkPwU8UVV/zujMq++byG8g7cPioQeQ3kyq6pEknwO+l+QV4D7gyVlX+WNGn9b0A+AhRk8EAF/sXrwNoyePB4BLgQuS/DfwQ+AzE/klpH3wxV1Jaoy7eiSpMYZfkhpj+CWpMYZfkhpj+CWpMYZfkhpj+CWpMf8LnIhAESg5FuoAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "#checking target distribution\n", + "sns.countplot(data = df, x = 'class')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# This dataset has 3 different classes" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(sepal length (cm),) False\n", + "(sepal width (cm),) False\n", + "(petal length (cm),) False\n", + "(petal width (cm),) False\n", + "class False\n", + "dtype: bool" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.isnull().any()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "From this, we can observe that the dataset has no missing values, so we are good to go." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
(sepal length (cm),)(sepal width (cm),)(petal length (cm),)(petal width (cm),)class
count150.000000150.000000150.000000150.000000150.000000
mean5.8433333.0573333.7580001.1993331.000000
std0.8280660.4358661.7652980.7622380.819232
min4.3000002.0000001.0000000.1000000.000000
25%5.1000002.8000001.6000000.3000000.000000
50%5.8000003.0000004.3500001.3000001.000000
75%6.4000003.3000005.1000001.8000002.000000
max7.9000004.4000006.9000002.5000002.000000
\n", + "
" + ], + "text/plain": [ + " (sepal length (cm),) (sepal width (cm),) (petal length (cm),) \\\n", + "count 150.000000 150.000000 150.000000 \n", + "mean 5.843333 3.057333 3.758000 \n", + "std 0.828066 0.435866 1.765298 \n", + "min 4.300000 2.000000 1.000000 \n", + "25% 5.100000 2.800000 1.600000 \n", + "50% 5.800000 3.000000 4.350000 \n", + "75% 6.400000 3.300000 5.100000 \n", + "max 7.900000 4.400000 6.900000 \n", + "\n", + " (petal width (cm),) class \n", + "count 150.000000 150.000000 \n", + "mean 1.199333 1.000000 \n", + "std 0.762238 0.819232 \n", + "min 0.100000 0.000000 \n", + "25% 0.300000 0.000000 \n", + "50% 1.300000 1.000000 \n", + "75% 1.800000 2.000000 \n", + "max 2.500000 2.000000 " + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.describe()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "full_data = df.astype(float).values.tolist()\n", + "random.shuffle(full_data)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "#dividing into train and test sets\n", + "test_size = 0.2\n", + "train_set ={0:[], 1:[], 2:[]}\n", + "test_set ={0:[], 1:[], 2:[]}\n", + "train_data = full_data[:-int(test_size*len(full_data))]\n", + "test_data = full_data[-int(test_size*len(full_data)):]\n", + "for i in train_data:\n", + " train_set[i[-1]].append(i[:-1])\n", + "for i in test_data:\n", + " test_set[i[-1]].append(i[:-1])" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(3, 3)" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(train_set), len(test_set)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Accuracy: 0.9666666666666667\n" + ] + } + ], + "source": [ + "#perform prediction using the knn_code1 algorithm\n", + "knn = k_nearest_neighbors(k=4) #k can be set to any value desired\n", + "preds = []\n", + "\n", + "predictions = knn.evaluate(train_set, test_set)\n", + "preds.append(predictions)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "let us set our value to 3 and observe our result" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Accuracy: 1.0\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\FAVOUR JAMES\\Documents\\GitHub\\ML-Algorithm-Challenge\\my_pckg\\knn_code1.py:14: UserWarning: k is set to a value less than total voting groups! \n", + " warnings.warn('k is set to a value less than total voting groups! ')\n" + ] + } + ], + "source": [ + "knn = k_nearest_neighbors(k=3) \n", + "preds = []\n", + "\n", + "predictions = knn.evaluate(train_set, test_set)\n", + "preds.append(predictions)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# TESTING THE ALGORITHM WITH REAL WORLD DATASET" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
idclump_thicknessunif_cell_sizeunif_cell_shapemarg_adhesionsingle_epith_cell_sizebare_nucleibland_chromnorm_nucleolimitosesclass
010000255111213112
1100294554457103212
210154253111223112
310162776881343712
410170234113213112
....................................
6947767153111321112
6958417692111211112
6968888205101037381024
69789747148643410614
69889747148854510414
\n", + "

699 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " id clump_thickness unif_cell_size unif_cell_shape marg_adhesion \\\n", + "0 1000025 5 1 1 1 \n", + "1 1002945 5 4 4 5 \n", + "2 1015425 3 1 1 1 \n", + "3 1016277 6 8 8 1 \n", + "4 1017023 4 1 1 3 \n", + ".. ... ... ... ... ... \n", + "694 776715 3 1 1 1 \n", + "695 841769 2 1 1 1 \n", + "696 888820 5 10 10 3 \n", + "697 897471 4 8 6 4 \n", + "698 897471 4 8 8 5 \n", + "\n", + " single_epith_cell_size bare_nuclei bland_chrom norm_nucleoli mitoses \\\n", + "0 2 1 3 1 1 \n", + "1 7 10 3 2 1 \n", + "2 2 2 3 1 1 \n", + "3 3 4 3 7 1 \n", + "4 2 1 3 1 1 \n", + ".. ... ... ... ... ... \n", + "694 3 2 1 1 1 \n", + "695 2 1 1 1 1 \n", + "696 7 3 8 10 2 \n", + "697 3 4 10 6 1 \n", + "698 4 5 10 4 1 \n", + "\n", + " class \n", + "0 2 \n", + "1 2 \n", + "2 2 \n", + "3 2 \n", + "4 2 \n", + ".. ... \n", + "694 2 \n", + "695 2 \n", + "696 4 \n", + "697 4 \n", + "698 4 \n", + "\n", + "[699 rows x 11 columns]" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = pd.read_csv('breast-cancer-wisconsin.csv')\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "id 0\n", + "clump_thickness 0\n", + "unif_cell_size 0\n", + "unif_cell_shape 0\n", + "marg_adhesion 0\n", + "single_epith_cell_size 0\n", + "bare_nuclei 0\n", + "bland_chrom 0\n", + "norm_nucleoli 0\n", + "mitoses 0\n", + "class 0\n", + "dtype: int64" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "df.replace('?', -99999, inplace=True)\n", + "df.drop(['id'], 1, inplace=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEGCAYAAACKB4k+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAOCUlEQVR4nO3dfayedX3H8ffHFmRGkIcenWs767R/TKdT1yAZ/5iyPxCVEicGo9I5YrdEN4g6ZWbzaZpodEMlxoSIUpibGnCjIyaGIOqeRFtAEBpDR1Q6kB7kQZ0PW/W7P+5ffx7aA9xir/s67Xm/kpP7un7Xde58T1J9c92PqSokSQJ4zNgDSJKWDqMgSeqMgiSpMwqSpM4oSJK6lWMP8KtYtWpVrVu3buwxJOmQsmPHjnuqam6xY4d0FNatW8f27dvHHkOSDilJvv1Qx3z4SJLUGQVJUmcUJEmdUZAkdUZBktQZBUlSZxQkSZ1RkCR1RkGS1B3S72g+GH7vLy4dewQtQTvef/bYI0ij8EpBktQZBUlSZxQkSZ1RkCR1RkGS1BkFSVJnFCRJnVGQJHVGQZLUGQVJUmcUJEmdUZAkdUZBktQZBUlSZxQkSZ1RkCR1RkGS1BkFSVJnFCRJnVGQJHVGQZLUGQVJUjd4FJKsSHJDkqva/lOTXJfktiSfTnJkW39s29/Vjq8bejZJ0oPN4krhXGDngv33ARdU1XrgPuCctn4OcF9VPR24oJ0nSZqhQaOQZA3wIuBjbT/ARuDydspW4Iy2vant046f0s6XJM3I0FcKHwTeDPy87Z8A3F9Ve9v+bmB1214N3AHQjj/Qzn+QJFuSbE+yfX5+fsjZJWnZGSwKSV4M7KmqHQuXFzm1pjj2i4Wqi6pqQ1VtmJubOwiTSpL2WTngfZ8MnJ7kNOAo4BgmVw7HJlnZrgbWAHe283cDa4HdSVYCTwDuHXA+SdJ+BrtSqKq/rKo1VbUOOAv4QlW9ErgWeF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rYkeTqqrp17MGk5lxgJ3DM2IMsB14pLHNVdVdVXd+2f8Dkf3yrx51KmkiyBngR8LGxZ1kujIK6JOuA5wLXjTuJ1H0QeDPw87EHWS6MggBI8njgCuC8qvr+2PNISV4M7KmqHWPPspwYBZHkCCZB+GRVfXbseaTmZOD0JN9i8qnJG5P8/bgjHf5889oylyTAVuDeqjpv7HmkxSR5AfCmqnrx2LMc7rxS0MnAq5n8V9iN7ee0sYeSNA6vFCRJnVcKkqTOKEiSOqMgSeqMgiSpMwqSpM4oSI9SknckedPYc0gHk1GQJHVGQZpSkrOT3JTk60ku2+/Ya5N8rR27Isnj2vqZSb7R1r/c1p6Z5KvtjYI3JVk/xt8jLcY3r0lTSPJM4LPAyVV1T5LjgT8HflhVH0hyQlV9r537buDuqrowyc3AqVX130mOrar7k1wIfKWqPpnkSGBFVf14rL9NWsgrBWk6G4HLq+oegKq6d7/jv5PkX1sEXgk8s63/O3BJktcCK9rafwJvTfIW4CkGQUuJUZCmE+DhLqsvAV5fVc8C3gkcBVBVfwr8FbAWuLFdUfwDcDrwY+DzSTYOObj0yzAK0nSuAV6e5ASA9vDRQkcDd7WPIX/lvsUkT6uq66rqbcA9wNokvwXcXlUfBrYBz57JXyBNwe9olqZQVbckeQ/wpSQ/A24AvrXglL9m8o113wZuZhIJgPe3J5LDJCxfB84HXpXk/4DvAu+ayR8hTcEnmiVJnQ8fSZI6oyBJ6oyCJKkzCpKkzihIkjqjIEnqjIIkqft/vMY1HyEna84AAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "#checking target distribution\n", + "sns.countplot(data = df, x = 'class')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# This dataset has 2 different classes" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
clump_thicknessunif_cell_sizeunif_cell_shapemarg_adhesionsingle_epith_cell_sizebland_chromnorm_nucleolimitosesclass
count699.000000699.000000699.000000699.000000699.000000699.000000699.000000699.000000699.000000
mean4.4177403.1344783.2074392.8068673.2160233.4377682.8669531.5894132.689557
std2.8157413.0514592.9719132.8553792.2143002.4383643.0536341.7150780.951273
min1.0000001.0000001.0000001.0000001.0000001.0000001.0000001.0000002.000000
25%2.0000001.0000001.0000001.0000002.0000002.0000001.0000001.0000002.000000
50%4.0000001.0000001.0000001.0000002.0000003.0000001.0000001.0000002.000000
75%6.0000005.0000005.0000004.0000004.0000005.0000004.0000001.0000004.000000
max10.00000010.00000010.00000010.00000010.00000010.00000010.00000010.0000004.000000
\n", + "
" + ], + "text/plain": [ + " clump_thickness unif_cell_size unif_cell_shape marg_adhesion \\\n", + "count 699.000000 699.000000 699.000000 699.000000 \n", + "mean 4.417740 3.134478 3.207439 2.806867 \n", + "std 2.815741 3.051459 2.971913 2.855379 \n", + "min 1.000000 1.000000 1.000000 1.000000 \n", + "25% 2.000000 1.000000 1.000000 1.000000 \n", + "50% 4.000000 1.000000 1.000000 1.000000 \n", + "75% 6.000000 5.000000 5.000000 4.000000 \n", + "max 10.000000 10.000000 10.000000 10.000000 \n", + "\n", + " single_epith_cell_size bland_chrom norm_nucleoli mitoses \\\n", + "count 699.000000 699.000000 699.000000 699.000000 \n", + "mean 3.216023 3.437768 2.866953 1.589413 \n", + "std 2.214300 2.438364 3.053634 1.715078 \n", + "min 1.000000 1.000000 1.000000 1.000000 \n", + "25% 2.000000 2.000000 1.000000 1.000000 \n", + "50% 2.000000 3.000000 1.000000 1.000000 \n", + "75% 4.000000 5.000000 4.000000 1.000000 \n", + "max 10.000000 10.000000 10.000000 10.000000 \n", + "\n", + " class \n", + "count 699.000000 \n", + "mean 2.689557 \n", + "std 0.951273 \n", + "min 2.000000 \n", + "25% 2.000000 \n", + "50% 2.000000 \n", + "75% 4.000000 \n", + "max 4.000000 " + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.describe()" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "full_data = df.astype(float).values.tolist()\n", + "random.shuffle(full_data)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [], + "source": [ + "#dividing into train and test sets\n", + "test_size = 0.2 #test_size can be set to any value desired\n", + "train_set ={2:[], 4:[]}\n", + "test_set ={2:[], 4:[]}\n", + "train_data = full_data[:-int(test_size*len(full_data))]\n", + "test_data = full_data[-int(test_size*len(full_data)):]\n", + "for i in train_data:\n", + " train_set[i[-1]].append(i[:-1])\n", + "for i in test_data:\n", + " test_set[i[-1]].append(i[:-1])" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(2, 2)" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(train_set), len(test_set)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Accuracy: 0.9712230215827338\n" + ] + } + ], + "source": [ + "#perform prediction using the knn_code1 algorithm\n", + "knn = k_nearest_neighbors(k=4) #k can be set to any value desired\n", + "preds = []\n", + "\n", + "predictions = knn.evaluate(train_set, test_set)\n", + "preds.append(predictions)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "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.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/James, Favour Utibe/my_python_package/__init__.py b/James, Favour Utibe/my_python_package/__init__.py new file mode 100644 index 0000000..fd8f0d6 --- /dev/null +++ b/James, Favour Utibe/my_python_package/__init__.py @@ -0,0 +1 @@ +from .knn_code1 import k_nearest_neighbors diff --git a/James, Favour Utibe/my_python_package/__pycache__/__init__.cpython-39.pyc b/James, Favour Utibe/my_python_package/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2511c7a9ff915d570b600112822c7f9640e9071e GIT binary patch literal 178 zcmYe~<>g`kf)kvd5tJkThvp6m2#vNCOBiG)80`#S*EI zR2B#F$=M&U`wsST|B|jd^}Jh8dz9*7D>94%^&Y7wzV|+U?>${!?jRTk5C8n>iHFc1 zX0aF!C_6CKD|k^vaf(7*ODnW%>4XkQD|It3^l)R-3R|#er+(HB+Za7Z)S>PzqAu%9 z?Qn_WBh>TW!HMXwhpX0}D7a=4)Kx7>!XwR;j#Qo|IyOd&VS%y(Q+)+5RtFMV6jSRK zK`=ITK!PLcfplpLocPtJqlhyi&4HXH!}C)iRcsD2!$>ptU@8MbiAxkg4)7~Bq2W=_ zsvO1AGwH(T-;r#AcrW%g2giy@H8|LP^ZoIU!OPv(&yEKBA}%tug86UF2OOi45FgPGrqL9I{PEOe%8%OzAp9>!4Bpwm48gU-Qg0g-- zuKXxUc%q}IZ6dA1$2S{yq}E>;#x_`*VgB%8);azLiiRwwkmm&+xpGZgGn?W$#%PEp z_VtSr@1wUn6X$vpuyEE9tojpII~VTE)6T3_x^rAhYmV2@98bK`p82I$Iz!mO=<@Li zy8QA47(wk@q}!!E1-=+>zgXt9DW0@+r)*8}Y>7H^Ox<(ViI`_91t8soDl*ae_4DlE!JTTiL*ZnogDfGm#wfP?ck}%HnzGr3okLFm$+(S>+Nb z$++@Jo-PYJ0Rl_r>KDHFhIh%ghp*OpMa2+H9sY~@WXVVi<~!egc?w??Y+&lu4K zR6}_0SrMlRWrXj4FbX?yN|bsdp!&kj=x|Xj9|2P>|0~-rc&&j(cm;QC2X{bj;QKaA zeDmOc(fXUG26U4`&C^p*D4qZ_fr(E`3s|^0aj&10Rta2z)z`o~G&A+;&8-QrvTThk zxmDWK`VM$pI<<5zH-L>RCrD#zm$3T&c;ldepGql^a9qkkGle@{H-RLZBr}Ckjr4=V}niC`U~Z?ujc>& literal 0 HcmV?d00001 diff --git a/James, Favour Utibe/my_python_package/__pycache__/knn_code1.cpython-37.pyc b/James, Favour Utibe/my_python_package/__pycache__/knn_code1.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf04add4de1c8119c82579f08f34b7b945c8c074 GIT binary patch literal 1675 zcmah}&2Jnv6u0MlH=7VXR1y)SE#kl)x+(&M6h%?e6k4G+phhLqXsf{)JDbVQcqX=| zB+=|?!ymw%!|suPX|9}l;KH#d-kV_&R6%%Tzi0c6-+RCJvmdOkb_ui(fB)l$p-0GX zI9WCals)MB2@ITYnv#$<(hBWHI-vv7O5My0J=)s%p$}_z8f2ZYL&+n;9q!%`?uzcr z4p%rmA_MOgoJbA_wDu43QW~K^T{ns)GBQG&NEc~hVl-Md3zR+R`ePVG6G&)r%B>p$ z!PwjZ368i2(&aul3F>zzkrYhffl?&nvy)uu7!SgR68iykjUZICA`#>Ozfug1P6k%( zXpx>O7q)*T$_MfK*}?YcxfV)~zTW@-+vm^v-|RpA>S**ZkIPI*qeqVt^SC@2J$-U- zKON^PF=yGmgEN+YUT@tJ{cvd* z+hB^<>QJzBro=+&gC|w>ueI34X3Vg z&fU3ZoVj1Q3))C)K{v>PPQA*W2bEVjV_2c&;{GwY_~;ml&g~mwI+Z;GN}#u&EIe&S zr@rY{{*2C7xU-<#-GtI_l4(!{Sop*1&nEpu_q8y6llNKwB}+@uPleWfbH*er8kY87 z<|dKj{#fN@q3`x%3W;GuXpoji(Di#TjKTMd-jr4l#U}aLx^S?3uh70J7nIN%-mhuW z%-R9rdfnYg6K&!=D|R>VFg)2K*I(QQ`dFCnl;BBhl3WgV(mZCV-UVfOf zRHo()RO;1#rP>3R4a$VB(XQ>#F32r<$A(U?@BS}Tf0Gmu$M_qPo`AyX6le)Fd{9|H z!R@Jg`FUkkKoppL0;D5zypP_(ngS&&e`2Yf%I4OWK;p`2q;s(aR9rhIhH|@t)ep$b zqNLS;1kPbokft=(o&7j26^pO72bRKm*KVN_X$C=yYo~pCfR$m;K0u)PajukzP3<$+v4r@$o7!uRzgh4)krAt;eX@HDn&3Lm4|%TLZ>-uSpJpgP!T Sli9_KqLEyPNk9>sp7ketdZd;B literal 0 HcmV?d00001 diff --git a/James, Favour Utibe/my_python_package/__pycache__/knn_code1.cpython-39.pyc b/James, Favour Utibe/my_python_package/__pycache__/knn_code1.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3c5516be9705ce076fb66c6dfa92eb5c8d79761c GIT binary patch literal 1716 zcmaJ>QEwbI5VpPEy}i3MK&YywjnE?XZ-+AZ#J9T^KNW! zQBHeL2|oad7f^*RkG%6I_zU~WQ(obX7ns@0MQKT~G@kKzJmZ=9Y;og8kHGk)`{%d6 zxrF?Ii>rgf;sKDsNfJqO64I8l&}lgjIdGP{V=wgR+@=$D9uetCeo7=y{1YeaO1eu1 z?m2iNI|JHuwu?&HM8~MOIv6Y-0GWF*C2g>fNh;YXfq<<`2jLq`MFaFgWw8Z-WtXb;%m-)w(4d}0!9 zhM#PG{l$~7g3q=df4n<izZdxbdSXQ<;q-AFtHjl}^^K$zy$C7&~CO7+nzXWSh{BAXrH01d=+W zBUj(HZ01OMMkz_j)T!x1@^oX$A!)u!Kwh7^mLIw^&+=KPcF$vPynnM;x1Yj%V7YK_l7vdkxLn)qLu}X4BiqGh^doTyCPDzktZ(-RnwT>O^L- zUEj!ySmb6CgvCjXmDd<-u+%uv<`yrF|DDhZaxe`?sbQ)Ny*yJQPeZN>Jq}%=wK#4( zQI?64jb{pN6R9!1us<#Ux^S~`p$1(I?~pWH3M(3J0o3q#AiPj#}zMSL+W9-o6C>6E3=E6JX-sdFiD3y;pynptK6JvV{+1hE8&{EuGFcf8sK%)T}4 z)K1-z&MI_$h7x=*c(TRlm$i3c!(VA*;XL1GfEK=!{`?b;-#;3#b8NvmLhSq>7y}-5 z_p3aQ+WI@0vU(Zz^a@M^zwM1i_=H_-O=Pl30-_d~iU8%IKi7iPn=8@Hg)NF23;uF5 zUZ0!JkCu66SHb9_D;&Dgqj%^X=F_#7CikxE%F8Zx1|EJgN{o{zYI;#LE@YLXyc9)8 zmB{Bi8at literal 0 HcmV?d00001 diff --git a/James, Favour Utibe/my_python_package/breast-cancer-wisconsin.csv b/James, Favour Utibe/my_python_package/breast-cancer-wisconsin.csv new file mode 100644 index 0000000..bbb33db --- /dev/null +++ b/James, Favour Utibe/my_python_package/breast-cancer-wisconsin.csv @@ -0,0 +1,700 @@ +id,clump_thickness,unif_cell_size,unif_cell_shape,marg_adhesion,single_epith_cell_size,bare_nuclei,bland_chrom,norm_nucleoli,mitoses,class +1000025,5,1,1,1,2,1,3,1,1,2 +1002945,5,4,4,5,7,10,3,2,1,2 +1015425,3,1,1,1,2,2,3,1,1,2 +1016277,6,8,8,1,3,4,3,7,1,2 +1017023,4,1,1,3,2,1,3,1,1,2 +1017122,8,10,10,8,7,10,9,7,1,4 +1018099,1,1,1,1,2,10,3,1,1,2 +1018561,2,1,2,1,2,1,3,1,1,2 +1033078,2,1,1,1,2,1,1,1,5,2 +1033078,4,2,1,1,2,1,2,1,1,2 +1035283,1,1,1,1,1,1,3,1,1,2 +1036172,2,1,1,1,2,1,2,1,1,2 +1041801,5,3,3,3,2,3,4,4,1,4 +1043999,1,1,1,1,2,3,3,1,1,2 +1044572,8,7,5,10,7,9,5,5,4,4 +1047630,7,4,6,4,6,1,4,3,1,4 +1048672,4,1,1,1,2,1,2,1,1,2 +1049815,4,1,1,1,2,1,3,1,1,2 +1050670,10,7,7,6,4,10,4,1,2,4 +1050718,6,1,1,1,2,1,3,1,1,2 +1054590,7,3,2,10,5,10,5,4,4,4 +1054593,10,5,5,3,6,7,7,10,1,4 +1056784,3,1,1,1,2,1,2,1,1,2 +1057013,8,4,5,1,2,?,7,3,1,4 +1059552,1,1,1,1,2,1,3,1,1,2 +1065726,5,2,3,4,2,7,3,6,1,4 +1066373,3,2,1,1,1,1,2,1,1,2 +1066979,5,1,1,1,2,1,2,1,1,2 +1067444,2,1,1,1,2,1,2,1,1,2 +1070935,1,1,3,1,2,1,1,1,1,2 +1070935,3,1,1,1,1,1,2,1,1,2 +1071760,2,1,1,1,2,1,3,1,1,2 +1072179,10,7,7,3,8,5,7,4,3,4 +1074610,2,1,1,2,2,1,3,1,1,2 +1075123,3,1,2,1,2,1,2,1,1,2 +1079304,2,1,1,1,2,1,2,1,1,2 +1080185,10,10,10,8,6,1,8,9,1,4 +1081791,6,2,1,1,1,1,7,1,1,2 +1084584,5,4,4,9,2,10,5,6,1,4 +1091262,2,5,3,3,6,7,7,5,1,4 +1096800,6,6,6,9,6,?,7,8,1,2 +1099510,10,4,3,1,3,3,6,5,2,4 +1100524,6,10,10,2,8,10,7,3,3,4 +1102573,5,6,5,6,10,1,3,1,1,4 +1103608,10,10,10,4,8,1,8,10,1,4 +1103722,1,1,1,1,2,1,2,1,2,2 +1105257,3,7,7,4,4,9,4,8,1,4 +1105524,1,1,1,1,2,1,2,1,1,2 +1106095,4,1,1,3,2,1,3,1,1,2 +1106829,7,8,7,2,4,8,3,8,2,4 +1108370,9,5,8,1,2,3,2,1,5,4 +1108449,5,3,3,4,2,4,3,4,1,4 +1110102,10,3,6,2,3,5,4,10,2,4 +1110503,5,5,5,8,10,8,7,3,7,4 +1110524,10,5,5,6,8,8,7,1,1,4 +1111249,10,6,6,3,4,5,3,6,1,4 +1112209,8,10,10,1,3,6,3,9,1,4 +1113038,8,2,4,1,5,1,5,4,4,4 +1113483,5,2,3,1,6,10,5,1,1,4 +1113906,9,5,5,2,2,2,5,1,1,4 +1115282,5,3,5,5,3,3,4,10,1,4 +1115293,1,1,1,1,2,2,2,1,1,2 +1116116,9,10,10,1,10,8,3,3,1,4 +1116132,6,3,4,1,5,2,3,9,1,4 +1116192,1,1,1,1,2,1,2,1,1,2 +1116998,10,4,2,1,3,2,4,3,10,4 +1117152,4,1,1,1,2,1,3,1,1,2 +1118039,5,3,4,1,8,10,4,9,1,4 +1120559,8,3,8,3,4,9,8,9,8,4 +1121732,1,1,1,1,2,1,3,2,1,2 +1121919,5,1,3,1,2,1,2,1,1,2 +1123061,6,10,2,8,10,2,7,8,10,4 +1124651,1,3,3,2,2,1,7,2,1,2 +1125035,9,4,5,10,6,10,4,8,1,4 +1126417,10,6,4,1,3,4,3,2,3,4 +1131294,1,1,2,1,2,2,4,2,1,2 +1132347,1,1,4,1,2,1,2,1,1,2 +1133041,5,3,1,2,2,1,2,1,1,2 +1133136,3,1,1,1,2,3,3,1,1,2 +1136142,2,1,1,1,3,1,2,1,1,2 +1137156,2,2,2,1,1,1,7,1,1,2 +1143978,4,1,1,2,2,1,2,1,1,2 +1143978,5,2,1,1,2,1,3,1,1,2 +1147044,3,1,1,1,2,2,7,1,1,2 +1147699,3,5,7,8,8,9,7,10,7,4 +1147748,5,10,6,1,10,4,4,10,10,4 +1148278,3,3,6,4,5,8,4,4,1,4 +1148873,3,6,6,6,5,10,6,8,3,4 +1152331,4,1,1,1,2,1,3,1,1,2 +1155546,2,1,1,2,3,1,2,1,1,2 +1156272,1,1,1,1,2,1,3,1,1,2 +1156948,3,1,1,2,2,1,1,1,1,2 +1157734,4,1,1,1,2,1,3,1,1,2 +1158247,1,1,1,1,2,1,2,1,1,2 +1160476,2,1,1,1,2,1,3,1,1,2 +1164066,1,1,1,1,2,1,3,1,1,2 +1165297,2,1,1,2,2,1,1,1,1,2 +1165790,5,1,1,1,2,1,3,1,1,2 +1165926,9,6,9,2,10,6,2,9,10,4 +1166630,7,5,6,10,5,10,7,9,4,4 +1166654,10,3,5,1,10,5,3,10,2,4 +1167439,2,3,4,4,2,5,2,5,1,4 +1167471,4,1,2,1,2,1,3,1,1,2 +1168359,8,2,3,1,6,3,7,1,1,4 +1168736,10,10,10,10,10,1,8,8,8,4 +1169049,7,3,4,4,3,3,3,2,7,4 +1170419,10,10,10,8,2,10,4,1,1,4 +1170420,1,6,8,10,8,10,5,7,1,4 +1171710,1,1,1,1,2,1,2,3,1,2 +1171710,6,5,4,4,3,9,7,8,3,4 +1171795,1,3,1,2,2,2,5,3,2,2 +1171845,8,6,4,3,5,9,3,1,1,4 +1172152,10,3,3,10,2,10,7,3,3,4 +1173216,10,10,10,3,10,8,8,1,1,4 +1173235,3,3,2,1,2,3,3,1,1,2 +1173347,1,1,1,1,2,5,1,1,1,2 +1173347,8,3,3,1,2,2,3,2,1,2 +1173509,4,5,5,10,4,10,7,5,8,4 +1173514,1,1,1,1,4,3,1,1,1,2 +1173681,3,2,1,1,2,2,3,1,1,2 +1174057,1,1,2,2,2,1,3,1,1,2 +1174057,4,2,1,1,2,2,3,1,1,2 +1174131,10,10,10,2,10,10,5,3,3,4 +1174428,5,3,5,1,8,10,5,3,1,4 +1175937,5,4,6,7,9,7,8,10,1,4 +1176406,1,1,1,1,2,1,2,1,1,2 +1176881,7,5,3,7,4,10,7,5,5,4 +1177027,3,1,1,1,2,1,3,1,1,2 +1177399,8,3,5,4,5,10,1,6,2,4 +1177512,1,1,1,1,10,1,1,1,1,2 +1178580,5,1,3,1,2,1,2,1,1,2 +1179818,2,1,1,1,2,1,3,1,1,2 +1180194,5,10,8,10,8,10,3,6,3,4 +1180523,3,1,1,1,2,1,2,2,1,2 +1180831,3,1,1,1,3,1,2,1,1,2 +1181356,5,1,1,1,2,2,3,3,1,2 +1182404,4,1,1,1,2,1,2,1,1,2 +1182410,3,1,1,1,2,1,1,1,1,2 +1183240,4,1,2,1,2,1,2,1,1,2 +1183246,1,1,1,1,1,?,2,1,1,2 +1183516,3,1,1,1,2,1,1,1,1,2 +1183911,2,1,1,1,2,1,1,1,1,2 +1183983,9,5,5,4,4,5,4,3,3,4 +1184184,1,1,1,1,2,5,1,1,1,2 +1184241,2,1,1,1,2,1,2,1,1,2 +1184840,1,1,3,1,2,?,2,1,1,2 +1185609,3,4,5,2,6,8,4,1,1,4 +1185610,1,1,1,1,3,2,2,1,1,2 +1187457,3,1,1,3,8,1,5,8,1,2 +1187805,8,8,7,4,10,10,7,8,7,4 +1188472,1,1,1,1,1,1,3,1,1,2 +1189266,7,2,4,1,6,10,5,4,3,4 +1189286,10,10,8,6,4,5,8,10,1,4 +1190394,4,1,1,1,2,3,1,1,1,2 +1190485,1,1,1,1,2,1,1,1,1,2 +1192325,5,5,5,6,3,10,3,1,1,4 +1193091,1,2,2,1,2,1,2,1,1,2 +1193210,2,1,1,1,2,1,3,1,1,2 +1193683,1,1,2,1,3,?,1,1,1,2 +1196295,9,9,10,3,6,10,7,10,6,4 +1196915,10,7,7,4,5,10,5,7,2,4 +1197080,4,1,1,1,2,1,3,2,1,2 +1197270,3,1,1,1,2,1,3,1,1,2 +1197440,1,1,1,2,1,3,1,1,7,2 +1197510,5,1,1,1,2,?,3,1,1,2 +1197979,4,1,1,1,2,2,3,2,1,2 +1197993,5,6,7,8,8,10,3,10,3,4 +1198128,10,8,10,10,6,1,3,1,10,4 +1198641,3,1,1,1,2,1,3,1,1,2 +1199219,1,1,1,2,1,1,1,1,1,2 +1199731,3,1,1,1,2,1,1,1,1,2 +1199983,1,1,1,1,2,1,3,1,1,2 +1200772,1,1,1,1,2,1,2,1,1,2 +1200847,6,10,10,10,8,10,10,10,7,4 +1200892,8,6,5,4,3,10,6,1,1,4 +1200952,5,8,7,7,10,10,5,7,1,4 +1201834,2,1,1,1,2,1,3,1,1,2 +1201936,5,10,10,3,8,1,5,10,3,4 +1202125,4,1,1,1,2,1,3,1,1,2 +1202812,5,3,3,3,6,10,3,1,1,4 +1203096,1,1,1,1,1,1,3,1,1,2 +1204242,1,1,1,1,2,1,1,1,1,2 +1204898,6,1,1,1,2,1,3,1,1,2 +1205138,5,8,8,8,5,10,7,8,1,4 +1205579,8,7,6,4,4,10,5,1,1,4 +1206089,2,1,1,1,1,1,3,1,1,2 +1206695,1,5,8,6,5,8,7,10,1,4 +1206841,10,5,6,10,6,10,7,7,10,4 +1207986,5,8,4,10,5,8,9,10,1,4 +1208301,1,2,3,1,2,1,3,1,1,2 +1210963,10,10,10,8,6,8,7,10,1,4 +1211202,7,5,10,10,10,10,4,10,3,4 +1212232,5,1,1,1,2,1,2,1,1,2 +1212251,1,1,1,1,2,1,3,1,1,2 +1212422,3,1,1,1,2,1,3,1,1,2 +1212422,4,1,1,1,2,1,3,1,1,2 +1213375,8,4,4,5,4,7,7,8,2,2 +1213383,5,1,1,4,2,1,3,1,1,2 +1214092,1,1,1,1,2,1,1,1,1,2 +1214556,3,1,1,1,2,1,2,1,1,2 +1214966,9,7,7,5,5,10,7,8,3,4 +1216694,10,8,8,4,10,10,8,1,1,4 +1216947,1,1,1,1,2,1,3,1,1,2 +1217051,5,1,1,1,2,1,3,1,1,2 +1217264,1,1,1,1,2,1,3,1,1,2 +1218105,5,10,10,9,6,10,7,10,5,4 +1218741,10,10,9,3,7,5,3,5,1,4 +1218860,1,1,1,1,1,1,3,1,1,2 +1218860,1,1,1,1,1,1,3,1,1,2 +1219406,5,1,1,1,1,1,3,1,1,2 +1219525,8,10,10,10,5,10,8,10,6,4 +1219859,8,10,8,8,4,8,7,7,1,4 +1220330,1,1,1,1,2,1,3,1,1,2 +1221863,10,10,10,10,7,10,7,10,4,4 +1222047,10,10,10,10,3,10,10,6,1,4 +1222936,8,7,8,7,5,5,5,10,2,4 +1223282,1,1,1,1,2,1,2,1,1,2 +1223426,1,1,1,1,2,1,3,1,1,2 +1223793,6,10,7,7,6,4,8,10,2,4 +1223967,6,1,3,1,2,1,3,1,1,2 +1224329,1,1,1,2,2,1,3,1,1,2 +1225799,10,6,4,3,10,10,9,10,1,4 +1226012,4,1,1,3,1,5,2,1,1,4 +1226612,7,5,6,3,3,8,7,4,1,4 +1227210,10,5,5,6,3,10,7,9,2,4 +1227244,1,1,1,1,2,1,2,1,1,2 +1227481,10,5,7,4,4,10,8,9,1,4 +1228152,8,9,9,5,3,5,7,7,1,4 +1228311,1,1,1,1,1,1,3,1,1,2 +1230175,10,10,10,3,10,10,9,10,1,4 +1230688,7,4,7,4,3,7,7,6,1,4 +1231387,6,8,7,5,6,8,8,9,2,4 +1231706,8,4,6,3,3,1,4,3,1,2 +1232225,10,4,5,5,5,10,4,1,1,4 +1236043,3,3,2,1,3,1,3,6,1,2 +1241232,3,1,4,1,2,?,3,1,1,2 +1241559,10,8,8,2,8,10,4,8,10,4 +1241679,9,8,8,5,6,2,4,10,4,4 +1242364,8,10,10,8,6,9,3,10,10,4 +1243256,10,4,3,2,3,10,5,3,2,4 +1270479,5,1,3,3,2,2,2,3,1,2 +1276091,3,1,1,3,1,1,3,1,1,2 +1277018,2,1,1,1,2,1,3,1,1,2 +128059,1,1,1,1,2,5,5,1,1,2 +1285531,1,1,1,1,2,1,3,1,1,2 +1287775,5,1,1,2,2,2,3,1,1,2 +144888,8,10,10,8,5,10,7,8,1,4 +145447,8,4,4,1,2,9,3,3,1,4 +167528,4,1,1,1,2,1,3,6,1,2 +169356,3,1,1,1,2,?,3,1,1,2 +183913,1,2,2,1,2,1,1,1,1,2 +191250,10,4,4,10,2,10,5,3,3,4 +1017023,6,3,3,5,3,10,3,5,3,2 +1100524,6,10,10,2,8,10,7,3,3,4 +1116116,9,10,10,1,10,8,3,3,1,4 +1168736,5,6,6,2,4,10,3,6,1,4 +1182404,3,1,1,1,2,1,1,1,1,2 +1182404,3,1,1,1,2,1,2,1,1,2 +1198641,3,1,1,1,2,1,3,1,1,2 +242970,5,7,7,1,5,8,3,4,1,2 +255644,10,5,8,10,3,10,5,1,3,4 +263538,5,10,10,6,10,10,10,6,5,4 +274137,8,8,9,4,5,10,7,8,1,4 +303213,10,4,4,10,6,10,5,5,1,4 +314428,7,9,4,10,10,3,5,3,3,4 +1182404,5,1,4,1,2,1,3,2,1,2 +1198641,10,10,6,3,3,10,4,3,2,4 +320675,3,3,5,2,3,10,7,1,1,4 +324427,10,8,8,2,3,4,8,7,8,4 +385103,1,1,1,1,2,1,3,1,1,2 +390840,8,4,7,1,3,10,3,9,2,4 +411453,5,1,1,1,2,1,3,1,1,2 +320675,3,3,5,2,3,10,7,1,1,4 +428903,7,2,4,1,3,4,3,3,1,4 +431495,3,1,1,1,2,1,3,2,1,2 +432809,3,1,3,1,2,?,2,1,1,2 +434518,3,1,1,1,2,1,2,1,1,2 +452264,1,1,1,1,2,1,2,1,1,2 +456282,1,1,1,1,2,1,3,1,1,2 +476903,10,5,7,3,3,7,3,3,8,4 +486283,3,1,1,1,2,1,3,1,1,2 +486662,2,1,1,2,2,1,3,1,1,2 +488173,1,4,3,10,4,10,5,6,1,4 +492268,10,4,6,1,2,10,5,3,1,4 +508234,7,4,5,10,2,10,3,8,2,4 +527363,8,10,10,10,8,10,10,7,3,4 +529329,10,10,10,10,10,10,4,10,10,4 +535331,3,1,1,1,3,1,2,1,1,2 +543558,6,1,3,1,4,5,5,10,1,4 +555977,5,6,6,8,6,10,4,10,4,4 +560680,1,1,1,1,2,1,1,1,1,2 +561477,1,1,1,1,2,1,3,1,1,2 +563649,8,8,8,1,2,?,6,10,1,4 +601265,10,4,4,6,2,10,2,3,1,4 +606140,1,1,1,1,2,?,2,1,1,2 +606722,5,5,7,8,6,10,7,4,1,4 +616240,5,3,4,3,4,5,4,7,1,2 +61634,5,4,3,1,2,?,2,3,1,2 +625201,8,2,1,1,5,1,1,1,1,2 +63375,9,1,2,6,4,10,7,7,2,4 +635844,8,4,10,5,4,4,7,10,1,4 +636130,1,1,1,1,2,1,3,1,1,2 +640744,10,10,10,7,9,10,7,10,10,4 +646904,1,1,1,1,2,1,3,1,1,2 +653777,8,3,4,9,3,10,3,3,1,4 +659642,10,8,4,4,4,10,3,10,4,4 +666090,1,1,1,1,2,1,3,1,1,2 +666942,1,1,1,1,2,1,3,1,1,2 +667204,7,8,7,6,4,3,8,8,4,4 +673637,3,1,1,1,2,5,5,1,1,2 +684955,2,1,1,1,3,1,2,1,1,2 +688033,1,1,1,1,2,1,1,1,1,2 +691628,8,6,4,10,10,1,3,5,1,4 +693702,1,1,1,1,2,1,1,1,1,2 +704097,1,1,1,1,1,1,2,1,1,2 +704168,4,6,5,6,7,?,4,9,1,2 +706426,5,5,5,2,5,10,4,3,1,4 +709287,6,8,7,8,6,8,8,9,1,4 +718641,1,1,1,1,5,1,3,1,1,2 +721482,4,4,4,4,6,5,7,3,1,2 +730881,7,6,3,2,5,10,7,4,6,4 +733639,3,1,1,1,2,?,3,1,1,2 +733639,3,1,1,1,2,1,3,1,1,2 +733823,5,4,6,10,2,10,4,1,1,4 +740492,1,1,1,1,2,1,3,1,1,2 +743348,3,2,2,1,2,1,2,3,1,2 +752904,10,1,1,1,2,10,5,4,1,4 +756136,1,1,1,1,2,1,2,1,1,2 +760001,8,10,3,2,6,4,3,10,1,4 +760239,10,4,6,4,5,10,7,1,1,4 +76389,10,4,7,2,2,8,6,1,1,4 +764974,5,1,1,1,2,1,3,1,2,2 +770066,5,2,2,2,2,1,2,2,1,2 +785208,5,4,6,6,4,10,4,3,1,4 +785615,8,6,7,3,3,10,3,4,2,4 +792744,1,1,1,1,2,1,1,1,1,2 +797327,6,5,5,8,4,10,3,4,1,4 +798429,1,1,1,1,2,1,3,1,1,2 +704097,1,1,1,1,1,1,2,1,1,2 +806423,8,5,5,5,2,10,4,3,1,4 +809912,10,3,3,1,2,10,7,6,1,4 +810104,1,1,1,1,2,1,3,1,1,2 +814265,2,1,1,1,2,1,1,1,1,2 +814911,1,1,1,1,2,1,1,1,1,2 +822829,7,6,4,8,10,10,9,5,3,4 +826923,1,1,1,1,2,1,1,1,1,2 +830690,5,2,2,2,3,1,1,3,1,2 +831268,1,1,1,1,1,1,1,3,1,2 +832226,3,4,4,10,5,1,3,3,1,4 +832567,4,2,3,5,3,8,7,6,1,4 +836433,5,1,1,3,2,1,1,1,1,2 +837082,2,1,1,1,2,1,3,1,1,2 +846832,3,4,5,3,7,3,4,6,1,2 +850831,2,7,10,10,7,10,4,9,4,4 +855524,1,1,1,1,2,1,2,1,1,2 +857774,4,1,1,1,3,1,2,2,1,2 +859164,5,3,3,1,3,3,3,3,3,4 +859350,8,10,10,7,10,10,7,3,8,4 +866325,8,10,5,3,8,4,4,10,3,4 +873549,10,3,5,4,3,7,3,5,3,4 +877291,6,10,10,10,10,10,8,10,10,4 +877943,3,10,3,10,6,10,5,1,4,4 +888169,3,2,2,1,4,3,2,1,1,2 +888523,4,4,4,2,2,3,2,1,1,2 +896404,2,1,1,1,2,1,3,1,1,2 +897172,2,1,1,1,2,1,2,1,1,2 +95719,6,10,10,10,8,10,7,10,7,4 +160296,5,8,8,10,5,10,8,10,3,4 +342245,1,1,3,1,2,1,1,1,1,2 +428598,1,1,3,1,1,1,2,1,1,2 +492561,4,3,2,1,3,1,2,1,1,2 +493452,1,1,3,1,2,1,1,1,1,2 +493452,4,1,2,1,2,1,2,1,1,2 +521441,5,1,1,2,2,1,2,1,1,2 +560680,3,1,2,1,2,1,2,1,1,2 +636437,1,1,1,1,2,1,1,1,1,2 +640712,1,1,1,1,2,1,2,1,1,2 +654244,1,1,1,1,1,1,2,1,1,2 +657753,3,1,1,4,3,1,2,2,1,2 +685977,5,3,4,1,4,1,3,1,1,2 +805448,1,1,1,1,2,1,1,1,1,2 +846423,10,6,3,6,4,10,7,8,4,4 +1002504,3,2,2,2,2,1,3,2,1,2 +1022257,2,1,1,1,2,1,1,1,1,2 +1026122,2,1,1,1,2,1,1,1,1,2 +1071084,3,3,2,2,3,1,1,2,3,2 +1080233,7,6,6,3,2,10,7,1,1,4 +1114570,5,3,3,2,3,1,3,1,1,2 +1114570,2,1,1,1,2,1,2,2,1,2 +1116715,5,1,1,1,3,2,2,2,1,2 +1131411,1,1,1,2,2,1,2,1,1,2 +1151734,10,8,7,4,3,10,7,9,1,4 +1156017,3,1,1,1,2,1,2,1,1,2 +1158247,1,1,1,1,1,1,1,1,1,2 +1158405,1,2,3,1,2,1,2,1,1,2 +1168278,3,1,1,1,2,1,2,1,1,2 +1176187,3,1,1,1,2,1,3,1,1,2 +1196263,4,1,1,1,2,1,1,1,1,2 +1196475,3,2,1,1,2,1,2,2,1,2 +1206314,1,2,3,1,2,1,1,1,1,2 +1211265,3,10,8,7,6,9,9,3,8,4 +1213784,3,1,1,1,2,1,1,1,1,2 +1223003,5,3,3,1,2,1,2,1,1,2 +1223306,3,1,1,1,2,4,1,1,1,2 +1223543,1,2,1,3,2,1,1,2,1,2 +1229929,1,1,1,1,2,1,2,1,1,2 +1231853,4,2,2,1,2,1,2,1,1,2 +1234554,1,1,1,1,2,1,2,1,1,2 +1236837,2,3,2,2,2,2,3,1,1,2 +1237674,3,1,2,1,2,1,2,1,1,2 +1238021,1,1,1,1,2,1,2,1,1,2 +1238464,1,1,1,1,1,?,2,1,1,2 +1238633,10,10,10,6,8,4,8,5,1,4 +1238915,5,1,2,1,2,1,3,1,1,2 +1238948,8,5,6,2,3,10,6,6,1,4 +1239232,3,3,2,6,3,3,3,5,1,2 +1239347,8,7,8,5,10,10,7,2,1,4 +1239967,1,1,1,1,2,1,2,1,1,2 +1240337,5,2,2,2,2,2,3,2,2,2 +1253505,2,3,1,1,5,1,1,1,1,2 +1255384,3,2,2,3,2,3,3,1,1,2 +1257200,10,10,10,7,10,10,8,2,1,4 +1257648,4,3,3,1,2,1,3,3,1,2 +1257815,5,1,3,1,2,1,2,1,1,2 +1257938,3,1,1,1,2,1,1,1,1,2 +1258549,9,10,10,10,10,10,10,10,1,4 +1258556,5,3,6,1,2,1,1,1,1,2 +1266154,8,7,8,2,4,2,5,10,1,4 +1272039,1,1,1,1,2,1,2,1,1,2 +1276091,2,1,1,1,2,1,2,1,1,2 +1276091,1,3,1,1,2,1,2,2,1,2 +1276091,5,1,1,3,4,1,3,2,1,2 +1277629,5,1,1,1,2,1,2,2,1,2 +1293439,3,2,2,3,2,1,1,1,1,2 +1293439,6,9,7,5,5,8,4,2,1,2 +1294562,10,8,10,1,3,10,5,1,1,4 +1295186,10,10,10,1,6,1,2,8,1,4 +527337,4,1,1,1,2,1,1,1,1,2 +558538,4,1,3,3,2,1,1,1,1,2 +566509,5,1,1,1,2,1,1,1,1,2 +608157,10,4,3,10,4,10,10,1,1,4 +677910,5,2,2,4,2,4,1,1,1,2 +734111,1,1,1,3,2,3,1,1,1,2 +734111,1,1,1,1,2,2,1,1,1,2 +780555,5,1,1,6,3,1,2,1,1,2 +827627,2,1,1,1,2,1,1,1,1,2 +1049837,1,1,1,1,2,1,1,1,1,2 +1058849,5,1,1,1,2,1,1,1,1,2 +1182404,1,1,1,1,1,1,1,1,1,2 +1193544,5,7,9,8,6,10,8,10,1,4 +1201870,4,1,1,3,1,1,2,1,1,2 +1202253,5,1,1,1,2,1,1,1,1,2 +1227081,3,1,1,3,2,1,1,1,1,2 +1230994,4,5,5,8,6,10,10,7,1,4 +1238410,2,3,1,1,3,1,1,1,1,2 +1246562,10,2,2,1,2,6,1,1,2,4 +1257470,10,6,5,8,5,10,8,6,1,4 +1259008,8,8,9,6,6,3,10,10,1,4 +1266124,5,1,2,1,2,1,1,1,1,2 +1267898,5,1,3,1,2,1,1,1,1,2 +1268313,5,1,1,3,2,1,1,1,1,2 +1268804,3,1,1,1,2,5,1,1,1,2 +1276091,6,1,1,3,2,1,1,1,1,2 +1280258,4,1,1,1,2,1,1,2,1,2 +1293966,4,1,1,1,2,1,1,1,1,2 +1296572,10,9,8,7,6,4,7,10,3,4 +1298416,10,6,6,2,4,10,9,7,1,4 +1299596,6,6,6,5,4,10,7,6,2,4 +1105524,4,1,1,1,2,1,1,1,1,2 +1181685,1,1,2,1,2,1,2,1,1,2 +1211594,3,1,1,1,1,1,2,1,1,2 +1238777,6,1,1,3,2,1,1,1,1,2 +1257608,6,1,1,1,1,1,1,1,1,2 +1269574,4,1,1,1,2,1,1,1,1,2 +1277145,5,1,1,1,2,1,1,1,1,2 +1287282,3,1,1,1,2,1,1,1,1,2 +1296025,4,1,2,1,2,1,1,1,1,2 +1296263,4,1,1,1,2,1,1,1,1,2 +1296593,5,2,1,1,2,1,1,1,1,2 +1299161,4,8,7,10,4,10,7,5,1,4 +1301945,5,1,1,1,1,1,1,1,1,2 +1302428,5,3,2,4,2,1,1,1,1,2 +1318169,9,10,10,10,10,5,10,10,10,4 +474162,8,7,8,5,5,10,9,10,1,4 +787451,5,1,2,1,2,1,1,1,1,2 +1002025,1,1,1,3,1,3,1,1,1,2 +1070522,3,1,1,1,1,1,2,1,1,2 +1073960,10,10,10,10,6,10,8,1,5,4 +1076352,3,6,4,10,3,3,3,4,1,4 +1084139,6,3,2,1,3,4,4,1,1,4 +1115293,1,1,1,1,2,1,1,1,1,2 +1119189,5,8,9,4,3,10,7,1,1,4 +1133991,4,1,1,1,1,1,2,1,1,2 +1142706,5,10,10,10,6,10,6,5,2,4 +1155967,5,1,2,10,4,5,2,1,1,2 +1170945,3,1,1,1,1,1,2,1,1,2 +1181567,1,1,1,1,1,1,1,1,1,2 +1182404,4,2,1,1,2,1,1,1,1,2 +1204558,4,1,1,1,2,1,2,1,1,2 +1217952,4,1,1,1,2,1,2,1,1,2 +1224565,6,1,1,1,2,1,3,1,1,2 +1238186,4,1,1,1,2,1,2,1,1,2 +1253917,4,1,1,2,2,1,2,1,1,2 +1265899,4,1,1,1,2,1,3,1,1,2 +1268766,1,1,1,1,2,1,1,1,1,2 +1277268,3,3,1,1,2,1,1,1,1,2 +1286943,8,10,10,10,7,5,4,8,7,4 +1295508,1,1,1,1,2,4,1,1,1,2 +1297327,5,1,1,1,2,1,1,1,1,2 +1297522,2,1,1,1,2,1,1,1,1,2 +1298360,1,1,1,1,2,1,1,1,1,2 +1299924,5,1,1,1,2,1,2,1,1,2 +1299994,5,1,1,1,2,1,1,1,1,2 +1304595,3,1,1,1,1,1,2,1,1,2 +1306282,6,6,7,10,3,10,8,10,2,4 +1313325,4,10,4,7,3,10,9,10,1,4 +1320077,1,1,1,1,1,1,1,1,1,2 +1320077,1,1,1,1,1,1,2,1,1,2 +1320304,3,1,2,2,2,1,1,1,1,2 +1330439,4,7,8,3,4,10,9,1,1,4 +333093,1,1,1,1,3,1,1,1,1,2 +369565,4,1,1,1,3,1,1,1,1,2 +412300,10,4,5,4,3,5,7,3,1,4 +672113,7,5,6,10,4,10,5,3,1,4 +749653,3,1,1,1,2,1,2,1,1,2 +769612,3,1,1,2,2,1,1,1,1,2 +769612,4,1,1,1,2,1,1,1,1,2 +798429,4,1,1,1,2,1,3,1,1,2 +807657,6,1,3,2,2,1,1,1,1,2 +8233704,4,1,1,1,1,1,2,1,1,2 +837480,7,4,4,3,4,10,6,9,1,4 +867392,4,2,2,1,2,1,2,1,1,2 +869828,1,1,1,1,1,1,3,1,1,2 +1043068,3,1,1,1,2,1,2,1,1,2 +1056171,2,1,1,1,2,1,2,1,1,2 +1061990,1,1,3,2,2,1,3,1,1,2 +1113061,5,1,1,1,2,1,3,1,1,2 +1116192,5,1,2,1,2,1,3,1,1,2 +1135090,4,1,1,1,2,1,2,1,1,2 +1145420,6,1,1,1,2,1,2,1,1,2 +1158157,5,1,1,1,2,2,2,1,1,2 +1171578,3,1,1,1,2,1,1,1,1,2 +1174841,5,3,1,1,2,1,1,1,1,2 +1184586,4,1,1,1,2,1,2,1,1,2 +1186936,2,1,3,2,2,1,2,1,1,2 +1197527,5,1,1,1,2,1,2,1,1,2 +1222464,6,10,10,10,4,10,7,10,1,4 +1240603,2,1,1,1,1,1,1,1,1,2 +1240603,3,1,1,1,1,1,1,1,1,2 +1241035,7,8,3,7,4,5,7,8,2,4 +1287971,3,1,1,1,2,1,2,1,1,2 +1289391,1,1,1,1,2,1,3,1,1,2 +1299924,3,2,2,2,2,1,4,2,1,2 +1306339,4,4,2,1,2,5,2,1,2,2 +1313658,3,1,1,1,2,1,1,1,1,2 +1313982,4,3,1,1,2,1,4,8,1,2 +1321264,5,2,2,2,1,1,2,1,1,2 +1321321,5,1,1,3,2,1,1,1,1,2 +1321348,2,1,1,1,2,1,2,1,1,2 +1321931,5,1,1,1,2,1,2,1,1,2 +1321942,5,1,1,1,2,1,3,1,1,2 +1321942,5,1,1,1,2,1,3,1,1,2 +1328331,1,1,1,1,2,1,3,1,1,2 +1328755,3,1,1,1,2,1,2,1,1,2 +1331405,4,1,1,1,2,1,3,2,1,2 +1331412,5,7,10,10,5,10,10,10,1,4 +1333104,3,1,2,1,2,1,3,1,1,2 +1334071,4,1,1,1,2,3,2,1,1,2 +1343068,8,4,4,1,6,10,2,5,2,4 +1343374,10,10,8,10,6,5,10,3,1,4 +1344121,8,10,4,4,8,10,8,2,1,4 +142932,7,6,10,5,3,10,9,10,2,4 +183936,3,1,1,1,2,1,2,1,1,2 +324382,1,1,1,1,2,1,2,1,1,2 +378275,10,9,7,3,4,2,7,7,1,4 +385103,5,1,2,1,2,1,3,1,1,2 +690557,5,1,1,1,2,1,2,1,1,2 +695091,1,1,1,1,2,1,2,1,1,2 +695219,1,1,1,1,2,1,2,1,1,2 +824249,1,1,1,1,2,1,3,1,1,2 +871549,5,1,2,1,2,1,2,1,1,2 +878358,5,7,10,6,5,10,7,5,1,4 +1107684,6,10,5,5,4,10,6,10,1,4 +1115762,3,1,1,1,2,1,1,1,1,2 +1217717,5,1,1,6,3,1,1,1,1,2 +1239420,1,1,1,1,2,1,1,1,1,2 +1254538,8,10,10,10,6,10,10,10,1,4 +1261751,5,1,1,1,2,1,2,2,1,2 +1268275,9,8,8,9,6,3,4,1,1,4 +1272166,5,1,1,1,2,1,1,1,1,2 +1294261,4,10,8,5,4,1,10,1,1,4 +1295529,2,5,7,6,4,10,7,6,1,4 +1298484,10,3,4,5,3,10,4,1,1,4 +1311875,5,1,2,1,2,1,1,1,1,2 +1315506,4,8,6,3,4,10,7,1,1,4 +1320141,5,1,1,1,2,1,2,1,1,2 +1325309,4,1,2,1,2,1,2,1,1,2 +1333063,5,1,3,1,2,1,3,1,1,2 +1333495,3,1,1,1,2,1,2,1,1,2 +1334659,5,2,4,1,1,1,1,1,1,2 +1336798,3,1,1,1,2,1,2,1,1,2 +1344449,1,1,1,1,1,1,2,1,1,2 +1350568,4,1,1,1,2,1,2,1,1,2 +1352663,5,4,6,8,4,1,8,10,1,4 +188336,5,3,2,8,5,10,8,1,2,4 +352431,10,5,10,3,5,8,7,8,3,4 +353098,4,1,1,2,2,1,1,1,1,2 +411453,1,1,1,1,2,1,1,1,1,2 +557583,5,10,10,10,10,10,10,1,1,4 +636375,5,1,1,1,2,1,1,1,1,2 +736150,10,4,3,10,3,10,7,1,2,4 +803531,5,10,10,10,5,2,8,5,1,4 +822829,8,10,10,10,6,10,10,10,10,4 +1016634,2,3,1,1,2,1,2,1,1,2 +1031608,2,1,1,1,1,1,2,1,1,2 +1041043,4,1,3,1,2,1,2,1,1,2 +1042252,3,1,1,1,2,1,2,1,1,2 +1057067,1,1,1,1,1,?,1,1,1,2 +1061990,4,1,1,1,2,1,2,1,1,2 +1073836,5,1,1,1,2,1,2,1,1,2 +1083817,3,1,1,1,2,1,2,1,1,2 +1096352,6,3,3,3,3,2,6,1,1,2 +1140597,7,1,2,3,2,1,2,1,1,2 +1149548,1,1,1,1,2,1,1,1,1,2 +1174009,5,1,1,2,1,1,2,1,1,2 +1183596,3,1,3,1,3,4,1,1,1,2 +1190386,4,6,6,5,7,6,7,7,3,4 +1190546,2,1,1,1,2,5,1,1,1,2 +1213273,2,1,1,1,2,1,1,1,1,2 +1218982,4,1,1,1,2,1,1,1,1,2 +1225382,6,2,3,1,2,1,1,1,1,2 +1235807,5,1,1,1,2,1,2,1,1,2 +1238777,1,1,1,1,2,1,1,1,1,2 +1253955,8,7,4,4,5,3,5,10,1,4 +1257366,3,1,1,1,2,1,1,1,1,2 +1260659,3,1,4,1,2,1,1,1,1,2 +1268952,10,10,7,8,7,1,10,10,3,4 +1275807,4,2,4,3,2,2,2,1,1,2 +1277792,4,1,1,1,2,1,1,1,1,2 +1277792,5,1,1,3,2,1,1,1,1,2 +1285722,4,1,1,3,2,1,1,1,1,2 +1288608,3,1,1,1,2,1,2,1,1,2 +1290203,3,1,1,1,2,1,2,1,1,2 +1294413,1,1,1,1,2,1,1,1,1,2 +1299596,2,1,1,1,2,1,1,1,1,2 +1303489,3,1,1,1,2,1,2,1,1,2 +1311033,1,2,2,1,2,1,1,1,1,2 +1311108,1,1,1,3,2,1,1,1,1,2 +1315807,5,10,10,10,10,2,10,10,10,4 +1318671,3,1,1,1,2,1,2,1,1,2 +1319609,3,1,1,2,3,4,1,1,1,2 +1323477,1,2,1,3,2,1,2,1,1,2 +1324572,5,1,1,1,2,1,2,2,1,2 +1324681,4,1,1,1,2,1,2,1,1,2 +1325159,3,1,1,1,2,1,3,1,1,2 +1326892,3,1,1,1,2,1,2,1,1,2 +1330361,5,1,1,1,2,1,2,1,1,2 +1333877,5,4,5,1,8,1,3,6,1,2 +1334015,7,8,8,7,3,10,7,2,3,4 +1334667,1,1,1,1,2,1,1,1,1,2 +1339781,1,1,1,1,2,1,2,1,1,2 +1339781,4,1,1,1,2,1,3,1,1,2 +13454352,1,1,3,1,2,1,2,1,1,2 +1345452,1,1,3,1,2,1,2,1,1,2 +1345593,3,1,1,3,2,1,2,1,1,2 +1347749,1,1,1,1,2,1,1,1,1,2 +1347943,5,2,2,2,2,1,1,1,2,2 +1348851,3,1,1,1,2,1,3,1,1,2 +1350319,5,7,4,1,6,1,7,10,3,4 +1350423,5,10,10,8,5,5,7,10,1,4 +1352848,3,10,7,8,5,8,7,4,1,4 +1353092,3,2,1,2,2,1,3,1,1,2 +1354840,2,1,1,1,2,1,3,1,1,2 +1354840,5,3,2,1,3,1,1,1,1,2 +1355260,1,1,1,1,2,1,2,1,1,2 +1365075,4,1,4,1,2,1,1,1,1,2 +1365328,1,1,2,1,2,1,2,1,1,2 +1368267,5,1,1,1,2,1,1,1,1,2 +1368273,1,1,1,1,2,1,1,1,1,2 +1368882,2,1,1,1,2,1,1,1,1,2 +1369821,10,10,10,10,5,10,10,10,7,4 +1371026,5,10,10,10,4,10,5,6,3,4 +1371920,5,1,1,1,2,1,3,2,1,2 +466906,1,1,1,1,2,1,1,1,1,2 +466906,1,1,1,1,2,1,1,1,1,2 +534555,1,1,1,1,2,1,1,1,1,2 +536708,1,1,1,1,2,1,1,1,1,2 +566346,3,1,1,1,2,1,2,3,1,2 +603148,4,1,1,1,2,1,1,1,1,2 +654546,1,1,1,1,2,1,1,1,8,2 +654546,1,1,1,3,2,1,1,1,1,2 +695091,5,10,10,5,4,5,4,4,1,4 +714039,3,1,1,1,2,1,1,1,1,2 +763235,3,1,1,1,2,1,2,1,2,2 +776715,3,1,1,1,3,2,1,1,1,2 +841769,2,1,1,1,2,1,1,1,1,2 +888820,5,10,10,3,7,3,8,10,2,4 +897471,4,8,6,4,3,4,10,6,1,4 +897471,4,8,8,5,4,5,10,4,1,4 diff --git a/James, Favour Utibe/my_python_package/breast-cancer-wisconsin.names b/James, Favour Utibe/my_python_package/breast-cancer-wisconsin.names new file mode 100644 index 0000000..54b59a1 --- /dev/null +++ b/James, Favour Utibe/my_python_package/breast-cancer-wisconsin.names @@ -0,0 +1,126 @@ +Citation Request: + This breast cancer databases was obtained from the University of Wisconsin + Hospitals, Madison from Dr. William H. Wolberg. If you publish results + when using this database, then please include this information in your + acknowledgements. Also, please cite one or more of: + + 1. O. L. Mangasarian and W. H. Wolberg: "Cancer diagnosis via linear + programming", SIAM News, Volume 23, Number 5, September 1990, pp 1 & 18. + + 2. William H. Wolberg and O.L. Mangasarian: "Multisurface method of + pattern separation for medical diagnosis applied to breast cytology", + Proceedings of the National Academy of Sciences, U.S.A., Volume 87, + December 1990, pp 9193-9196. + + 3. O. L. Mangasarian, R. Setiono, and W.H. Wolberg: "Pattern recognition + via linear programming: Theory and application to medical diagnosis", + in: "Large-scale numerical optimization", Thomas F. Coleman and Yuying + Li, editors, SIAM Publications, Philadelphia 1990, pp 22-30. + + 4. K. P. Bennett & O. L. Mangasarian: "Robust linear programming + discrimination of two linearly inseparable sets", Optimization Methods + and Software 1, 1992, 23-34 (Gordon & Breach Science Publishers). + +1. Title: Wisconsin Breast Cancer Database (January 8, 1991) + +2. Sources: + -- Dr. WIlliam H. Wolberg (physician) + University of Wisconsin Hospitals + Madison, Wisconsin + USA + -- Donor: Olvi Mangasarian (mangasarian@cs.wisc.edu) + Received by David W. Aha (aha@cs.jhu.edu) + -- Date: 15 July 1992 + +3. Past Usage: + + Attributes 2 through 10 have been used to represent instances. + Each instance has one of 2 possible classes: benign or malignant. + + 1. Wolberg,~W.~H., \& Mangasarian,~O.~L. (1990). Multisurface method of + pattern separation for medical diagnosis applied to breast cytology. In + {\it Proceedings of the National Academy of Sciences}, {\it 87}, + 9193--9196. + -- Size of data set: only 369 instances (at that point in time) + -- Collected classification results: 1 trial only + -- Two pairs of parallel hyperplanes were found to be consistent with + 50% of the data + -- Accuracy on remaining 50% of dataset: 93.5% + -- Three pairs of parallel hyperplanes were found to be consistent with + 67% of data + -- Accuracy on remaining 33% of dataset: 95.9% + + 2. Zhang,~J. (1992). Selecting typical instances in instance-based + learning. In {\it Proceedings of the Ninth International Machine + Learning Conference} (pp. 470--479). Aberdeen, Scotland: Morgan + Kaufmann. + -- Size of data set: only 369 instances (at that point in time) + -- Applied 4 instance-based learning algorithms + -- Collected classification results averaged over 10 trials + -- Best accuracy result: + -- 1-nearest neighbor: 93.7% + -- trained on 200 instances, tested on the other 169 + -- Also of interest: + -- Using only typical instances: 92.2% (storing only 23.1 instances) + -- trained on 200 instances, tested on the other 169 + +4. Relevant Information: + + Samples arrive periodically as Dr. Wolberg reports his clinical cases. + The database therefore reflects this chronological grouping of the data. + This grouping information appears immediately below, having been removed + from the data itself: + + Group 1: 367 instances (January 1989) + Group 2: 70 instances (October 1989) + Group 3: 31 instances (February 1990) + Group 4: 17 instances (April 1990) + Group 5: 48 instances (August 1990) + Group 6: 49 instances (Updated January 1991) + Group 7: 31 instances (June 1991) + Group 8: 86 instances (November 1991) + ----------------------------------------- + Total: 699 points (as of the donated datbase on 15 July 1992) + + Note that the results summarized above in Past Usage refer to a dataset + of size 369, while Group 1 has only 367 instances. This is because it + originally contained 369 instances; 2 were removed. The following + statements summarizes changes to the original Group 1's set of data: + + ##### Group 1 : 367 points: 200B 167M (January 1989) + ##### Revised Jan 10, 1991: Replaced zero bare nuclei in 1080185 & 1187805 + ##### Revised Nov 22,1991: Removed 765878,4,5,9,7,10,10,10,3,8,1 no record + ##### : Removed 484201,2,7,8,8,4,3,10,3,4,1 zero epithelial + ##### : Changed 0 to 1 in field 6 of sample 1219406 + ##### : Changed 0 to 1 in field 8 of following sample: + ##### : 1182404,2,3,1,1,1,2,0,1,1,1 + +5. Number of Instances: 699 (as of 15 July 1992) + +6. Number of Attributes: 10 plus the class attribute + +7. Attribute Information: (class attribute has been moved to last column) + + # Attribute Domain + -- ----------------------------------------- + 1. Sample code number id number + 2. Clump Thickness 1 - 10 + 3. Uniformity of Cell Size 1 - 10 + 4. Uniformity of Cell Shape 1 - 10 + 5. Marginal Adhesion 1 - 10 + 6. Single Epithelial Cell Size 1 - 10 + 7. Bare Nuclei 1 - 10 + 8. Bland Chromatin 1 - 10 + 9. Normal Nucleoli 1 - 10 + 10. Mitoses 1 - 10 + 11. Class: (2 for benign, 4 for malignant) + +8. Missing attribute values: 16 + + There are 16 instances in Groups 1 to 6 that contain a single missing + (i.e., unavailable) attribute value, now denoted by "?". + +9. Class distribution: + + Benign: 458 (65.5%) + Malignant: 241 (34.5%) diff --git a/James, Favour Utibe/my_python_package/knn_code.py b/James, Favour Utibe/my_python_package/knn_code.py new file mode 100644 index 0000000..18c7a2b --- /dev/null +++ b/James, Favour Utibe/my_python_package/knn_code.py @@ -0,0 +1,43 @@ +import numpy as np +import pandas as pd +import warnings +from collections import Counter +import random +from sklearn.model_selection import train_test_split + +class k_nearest_neighbors(object): + def __init__(self, k): + self.k = k + + def getPrediction(self, df, predict): + if len(df)>=self.k: + warnings.warn('k is set to a value less than total voting groups! ') + + ##getting the distance between the former points and the new points + distances = [] + for group in df: + for features in df[group]: + EuclideanDistance = np.linalg.norm(np.array(features) - np.array(predict)) + distances.append([EuclideanDistance, group]) + + ##getting the nearest neighbors of the new points based on the closest distance + classVotes = [i[1] for i in sorted(distances)[:self.k]] + kNeighbors = Counter(classVotes).most_common(1)[0][0] + return kNeighbors + + def evaluate(self, train_set, test_set): + correct = 0 + total = 0 + for group in test_set: + for data in test_set[group]: + vote = self.getPrediction(train_set, data) + if group == vote: + correct += 1 + total += 1 + + print('Accuracy:',correct/total) + return correct/total + + + + diff --git a/James, Favour Utibe/setup.py b/James, Favour Utibe/setup.py new file mode 100644 index 0000000..d4af780 --- /dev/null +++ b/James, Favour Utibe/setup.py @@ -0,0 +1,10 @@ +from setuptools import setup +setup(name='my_pckg', +version='0.1', +description='Testing installation of Package', +url='#', +author='auth', +author_email='author@email.com', +license='MIT', +packages=['my_pckg'], +zip_safe=False) diff --git a/README.md b/README.md deleted file mode 100644 index c219c75..0000000 --- a/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# ML-Algorithm-Challenge - -| ![community logo](oau.png) | AI+ OAU Algorithm Challenge | -| -------------------------- | --------------------------- | - -A lot of data scientists or machine learning enthusiasts do use various machine learning algorithms as a black box without knowing how they work or the mathematics behind it. The purpose of this challenge is to encourage the mathematical understanding of machine learning algorithms, their break and yield point. - -In summary, participants are encouraged to understand the fundamental concepts behind machine learning algorithms/models. - -The rules and guidelines for this challenge are as follows: - -1. Ensure to register at https://bit.ly/oaumlchallenge - -2. The algorithm challenge is open to all AI+ OAU Members. - -3. Participants are expected to design and develop the K Nearest Neighbour (KNN) algorithm from scratch using Python or R programming. - -4. For python developers (numpy is advisable). - -5. To push your solution to us, make a [pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests) to AI+ OAU GitHub page at https://github.com/datascienceife/ML-Algorithm-Challenge. Ensure to add your readme file to understand your code. - -6. The top 3 optimized code will be compensated as follows: - -- **1st position**: N7000. :trophy: -- **2nd position**: N5000. :trophy: -- **3rd position**: N3000. :trophy: - -7. Add your scripts and readme.MD file as a folder saved as your full name (surname_first_middle name) by making a pull request to the repository. - ---- - -For issues on this challenge kindly reach out to the AI+campus Managers - -**WHATSAPP**: - -**Paul:** +2348177055301, - -**Dunsin:** +2348133331794. - -Good luck! diff --git a/breast-cancer-wisconsin.csv b/breast-cancer-wisconsin.csv new file mode 100644 index 0000000..bbb33db --- /dev/null +++ b/breast-cancer-wisconsin.csv @@ -0,0 +1,700 @@ +id,clump_thickness,unif_cell_size,unif_cell_shape,marg_adhesion,single_epith_cell_size,bare_nuclei,bland_chrom,norm_nucleoli,mitoses,class +1000025,5,1,1,1,2,1,3,1,1,2 +1002945,5,4,4,5,7,10,3,2,1,2 +1015425,3,1,1,1,2,2,3,1,1,2 +1016277,6,8,8,1,3,4,3,7,1,2 +1017023,4,1,1,3,2,1,3,1,1,2 +1017122,8,10,10,8,7,10,9,7,1,4 +1018099,1,1,1,1,2,10,3,1,1,2 +1018561,2,1,2,1,2,1,3,1,1,2 +1033078,2,1,1,1,2,1,1,1,5,2 +1033078,4,2,1,1,2,1,2,1,1,2 +1035283,1,1,1,1,1,1,3,1,1,2 +1036172,2,1,1,1,2,1,2,1,1,2 +1041801,5,3,3,3,2,3,4,4,1,4 +1043999,1,1,1,1,2,3,3,1,1,2 +1044572,8,7,5,10,7,9,5,5,4,4 +1047630,7,4,6,4,6,1,4,3,1,4 +1048672,4,1,1,1,2,1,2,1,1,2 +1049815,4,1,1,1,2,1,3,1,1,2 +1050670,10,7,7,6,4,10,4,1,2,4 +1050718,6,1,1,1,2,1,3,1,1,2 +1054590,7,3,2,10,5,10,5,4,4,4 +1054593,10,5,5,3,6,7,7,10,1,4 +1056784,3,1,1,1,2,1,2,1,1,2 +1057013,8,4,5,1,2,?,7,3,1,4 +1059552,1,1,1,1,2,1,3,1,1,2 +1065726,5,2,3,4,2,7,3,6,1,4 +1066373,3,2,1,1,1,1,2,1,1,2 +1066979,5,1,1,1,2,1,2,1,1,2 +1067444,2,1,1,1,2,1,2,1,1,2 +1070935,1,1,3,1,2,1,1,1,1,2 +1070935,3,1,1,1,1,1,2,1,1,2 +1071760,2,1,1,1,2,1,3,1,1,2 +1072179,10,7,7,3,8,5,7,4,3,4 +1074610,2,1,1,2,2,1,3,1,1,2 +1075123,3,1,2,1,2,1,2,1,1,2 +1079304,2,1,1,1,2,1,2,1,1,2 +1080185,10,10,10,8,6,1,8,9,1,4 +1081791,6,2,1,1,1,1,7,1,1,2 +1084584,5,4,4,9,2,10,5,6,1,4 +1091262,2,5,3,3,6,7,7,5,1,4 +1096800,6,6,6,9,6,?,7,8,1,2 +1099510,10,4,3,1,3,3,6,5,2,4 +1100524,6,10,10,2,8,10,7,3,3,4 +1102573,5,6,5,6,10,1,3,1,1,4 +1103608,10,10,10,4,8,1,8,10,1,4 +1103722,1,1,1,1,2,1,2,1,2,2 +1105257,3,7,7,4,4,9,4,8,1,4 +1105524,1,1,1,1,2,1,2,1,1,2 +1106095,4,1,1,3,2,1,3,1,1,2 +1106829,7,8,7,2,4,8,3,8,2,4 +1108370,9,5,8,1,2,3,2,1,5,4 +1108449,5,3,3,4,2,4,3,4,1,4 +1110102,10,3,6,2,3,5,4,10,2,4 +1110503,5,5,5,8,10,8,7,3,7,4 +1110524,10,5,5,6,8,8,7,1,1,4 +1111249,10,6,6,3,4,5,3,6,1,4 +1112209,8,10,10,1,3,6,3,9,1,4 +1113038,8,2,4,1,5,1,5,4,4,4 +1113483,5,2,3,1,6,10,5,1,1,4 +1113906,9,5,5,2,2,2,5,1,1,4 +1115282,5,3,5,5,3,3,4,10,1,4 +1115293,1,1,1,1,2,2,2,1,1,2 +1116116,9,10,10,1,10,8,3,3,1,4 +1116132,6,3,4,1,5,2,3,9,1,4 +1116192,1,1,1,1,2,1,2,1,1,2 +1116998,10,4,2,1,3,2,4,3,10,4 +1117152,4,1,1,1,2,1,3,1,1,2 +1118039,5,3,4,1,8,10,4,9,1,4 +1120559,8,3,8,3,4,9,8,9,8,4 +1121732,1,1,1,1,2,1,3,2,1,2 +1121919,5,1,3,1,2,1,2,1,1,2 +1123061,6,10,2,8,10,2,7,8,10,4 +1124651,1,3,3,2,2,1,7,2,1,2 +1125035,9,4,5,10,6,10,4,8,1,4 +1126417,10,6,4,1,3,4,3,2,3,4 +1131294,1,1,2,1,2,2,4,2,1,2 +1132347,1,1,4,1,2,1,2,1,1,2 +1133041,5,3,1,2,2,1,2,1,1,2 +1133136,3,1,1,1,2,3,3,1,1,2 +1136142,2,1,1,1,3,1,2,1,1,2 +1137156,2,2,2,1,1,1,7,1,1,2 +1143978,4,1,1,2,2,1,2,1,1,2 +1143978,5,2,1,1,2,1,3,1,1,2 +1147044,3,1,1,1,2,2,7,1,1,2 +1147699,3,5,7,8,8,9,7,10,7,4 +1147748,5,10,6,1,10,4,4,10,10,4 +1148278,3,3,6,4,5,8,4,4,1,4 +1148873,3,6,6,6,5,10,6,8,3,4 +1152331,4,1,1,1,2,1,3,1,1,2 +1155546,2,1,1,2,3,1,2,1,1,2 +1156272,1,1,1,1,2,1,3,1,1,2 +1156948,3,1,1,2,2,1,1,1,1,2 +1157734,4,1,1,1,2,1,3,1,1,2 +1158247,1,1,1,1,2,1,2,1,1,2 +1160476,2,1,1,1,2,1,3,1,1,2 +1164066,1,1,1,1,2,1,3,1,1,2 +1165297,2,1,1,2,2,1,1,1,1,2 +1165790,5,1,1,1,2,1,3,1,1,2 +1165926,9,6,9,2,10,6,2,9,10,4 +1166630,7,5,6,10,5,10,7,9,4,4 +1166654,10,3,5,1,10,5,3,10,2,4 +1167439,2,3,4,4,2,5,2,5,1,4 +1167471,4,1,2,1,2,1,3,1,1,2 +1168359,8,2,3,1,6,3,7,1,1,4 +1168736,10,10,10,10,10,1,8,8,8,4 +1169049,7,3,4,4,3,3,3,2,7,4 +1170419,10,10,10,8,2,10,4,1,1,4 +1170420,1,6,8,10,8,10,5,7,1,4 +1171710,1,1,1,1,2,1,2,3,1,2 +1171710,6,5,4,4,3,9,7,8,3,4 +1171795,1,3,1,2,2,2,5,3,2,2 +1171845,8,6,4,3,5,9,3,1,1,4 +1172152,10,3,3,10,2,10,7,3,3,4 +1173216,10,10,10,3,10,8,8,1,1,4 +1173235,3,3,2,1,2,3,3,1,1,2 +1173347,1,1,1,1,2,5,1,1,1,2 +1173347,8,3,3,1,2,2,3,2,1,2 +1173509,4,5,5,10,4,10,7,5,8,4 +1173514,1,1,1,1,4,3,1,1,1,2 +1173681,3,2,1,1,2,2,3,1,1,2 +1174057,1,1,2,2,2,1,3,1,1,2 +1174057,4,2,1,1,2,2,3,1,1,2 +1174131,10,10,10,2,10,10,5,3,3,4 +1174428,5,3,5,1,8,10,5,3,1,4 +1175937,5,4,6,7,9,7,8,10,1,4 +1176406,1,1,1,1,2,1,2,1,1,2 +1176881,7,5,3,7,4,10,7,5,5,4 +1177027,3,1,1,1,2,1,3,1,1,2 +1177399,8,3,5,4,5,10,1,6,2,4 +1177512,1,1,1,1,10,1,1,1,1,2 +1178580,5,1,3,1,2,1,2,1,1,2 +1179818,2,1,1,1,2,1,3,1,1,2 +1180194,5,10,8,10,8,10,3,6,3,4 +1180523,3,1,1,1,2,1,2,2,1,2 +1180831,3,1,1,1,3,1,2,1,1,2 +1181356,5,1,1,1,2,2,3,3,1,2 +1182404,4,1,1,1,2,1,2,1,1,2 +1182410,3,1,1,1,2,1,1,1,1,2 +1183240,4,1,2,1,2,1,2,1,1,2 +1183246,1,1,1,1,1,?,2,1,1,2 +1183516,3,1,1,1,2,1,1,1,1,2 +1183911,2,1,1,1,2,1,1,1,1,2 +1183983,9,5,5,4,4,5,4,3,3,4 +1184184,1,1,1,1,2,5,1,1,1,2 +1184241,2,1,1,1,2,1,2,1,1,2 +1184840,1,1,3,1,2,?,2,1,1,2 +1185609,3,4,5,2,6,8,4,1,1,4 +1185610,1,1,1,1,3,2,2,1,1,2 +1187457,3,1,1,3,8,1,5,8,1,2 +1187805,8,8,7,4,10,10,7,8,7,4 +1188472,1,1,1,1,1,1,3,1,1,2 +1189266,7,2,4,1,6,10,5,4,3,4 +1189286,10,10,8,6,4,5,8,10,1,4 +1190394,4,1,1,1,2,3,1,1,1,2 +1190485,1,1,1,1,2,1,1,1,1,2 +1192325,5,5,5,6,3,10,3,1,1,4 +1193091,1,2,2,1,2,1,2,1,1,2 +1193210,2,1,1,1,2,1,3,1,1,2 +1193683,1,1,2,1,3,?,1,1,1,2 +1196295,9,9,10,3,6,10,7,10,6,4 +1196915,10,7,7,4,5,10,5,7,2,4 +1197080,4,1,1,1,2,1,3,2,1,2 +1197270,3,1,1,1,2,1,3,1,1,2 +1197440,1,1,1,2,1,3,1,1,7,2 +1197510,5,1,1,1,2,?,3,1,1,2 +1197979,4,1,1,1,2,2,3,2,1,2 +1197993,5,6,7,8,8,10,3,10,3,4 +1198128,10,8,10,10,6,1,3,1,10,4 +1198641,3,1,1,1,2,1,3,1,1,2 +1199219,1,1,1,2,1,1,1,1,1,2 +1199731,3,1,1,1,2,1,1,1,1,2 +1199983,1,1,1,1,2,1,3,1,1,2 +1200772,1,1,1,1,2,1,2,1,1,2 +1200847,6,10,10,10,8,10,10,10,7,4 +1200892,8,6,5,4,3,10,6,1,1,4 +1200952,5,8,7,7,10,10,5,7,1,4 +1201834,2,1,1,1,2,1,3,1,1,2 +1201936,5,10,10,3,8,1,5,10,3,4 +1202125,4,1,1,1,2,1,3,1,1,2 +1202812,5,3,3,3,6,10,3,1,1,4 +1203096,1,1,1,1,1,1,3,1,1,2 +1204242,1,1,1,1,2,1,1,1,1,2 +1204898,6,1,1,1,2,1,3,1,1,2 +1205138,5,8,8,8,5,10,7,8,1,4 +1205579,8,7,6,4,4,10,5,1,1,4 +1206089,2,1,1,1,1,1,3,1,1,2 +1206695,1,5,8,6,5,8,7,10,1,4 +1206841,10,5,6,10,6,10,7,7,10,4 +1207986,5,8,4,10,5,8,9,10,1,4 +1208301,1,2,3,1,2,1,3,1,1,2 +1210963,10,10,10,8,6,8,7,10,1,4 +1211202,7,5,10,10,10,10,4,10,3,4 +1212232,5,1,1,1,2,1,2,1,1,2 +1212251,1,1,1,1,2,1,3,1,1,2 +1212422,3,1,1,1,2,1,3,1,1,2 +1212422,4,1,1,1,2,1,3,1,1,2 +1213375,8,4,4,5,4,7,7,8,2,2 +1213383,5,1,1,4,2,1,3,1,1,2 +1214092,1,1,1,1,2,1,1,1,1,2 +1214556,3,1,1,1,2,1,2,1,1,2 +1214966,9,7,7,5,5,10,7,8,3,4 +1216694,10,8,8,4,10,10,8,1,1,4 +1216947,1,1,1,1,2,1,3,1,1,2 +1217051,5,1,1,1,2,1,3,1,1,2 +1217264,1,1,1,1,2,1,3,1,1,2 +1218105,5,10,10,9,6,10,7,10,5,4 +1218741,10,10,9,3,7,5,3,5,1,4 +1218860,1,1,1,1,1,1,3,1,1,2 +1218860,1,1,1,1,1,1,3,1,1,2 +1219406,5,1,1,1,1,1,3,1,1,2 +1219525,8,10,10,10,5,10,8,10,6,4 +1219859,8,10,8,8,4,8,7,7,1,4 +1220330,1,1,1,1,2,1,3,1,1,2 +1221863,10,10,10,10,7,10,7,10,4,4 +1222047,10,10,10,10,3,10,10,6,1,4 +1222936,8,7,8,7,5,5,5,10,2,4 +1223282,1,1,1,1,2,1,2,1,1,2 +1223426,1,1,1,1,2,1,3,1,1,2 +1223793,6,10,7,7,6,4,8,10,2,4 +1223967,6,1,3,1,2,1,3,1,1,2 +1224329,1,1,1,2,2,1,3,1,1,2 +1225799,10,6,4,3,10,10,9,10,1,4 +1226012,4,1,1,3,1,5,2,1,1,4 +1226612,7,5,6,3,3,8,7,4,1,4 +1227210,10,5,5,6,3,10,7,9,2,4 +1227244,1,1,1,1,2,1,2,1,1,2 +1227481,10,5,7,4,4,10,8,9,1,4 +1228152,8,9,9,5,3,5,7,7,1,4 +1228311,1,1,1,1,1,1,3,1,1,2 +1230175,10,10,10,3,10,10,9,10,1,4 +1230688,7,4,7,4,3,7,7,6,1,4 +1231387,6,8,7,5,6,8,8,9,2,4 +1231706,8,4,6,3,3,1,4,3,1,2 +1232225,10,4,5,5,5,10,4,1,1,4 +1236043,3,3,2,1,3,1,3,6,1,2 +1241232,3,1,4,1,2,?,3,1,1,2 +1241559,10,8,8,2,8,10,4,8,10,4 +1241679,9,8,8,5,6,2,4,10,4,4 +1242364,8,10,10,8,6,9,3,10,10,4 +1243256,10,4,3,2,3,10,5,3,2,4 +1270479,5,1,3,3,2,2,2,3,1,2 +1276091,3,1,1,3,1,1,3,1,1,2 +1277018,2,1,1,1,2,1,3,1,1,2 +128059,1,1,1,1,2,5,5,1,1,2 +1285531,1,1,1,1,2,1,3,1,1,2 +1287775,5,1,1,2,2,2,3,1,1,2 +144888,8,10,10,8,5,10,7,8,1,4 +145447,8,4,4,1,2,9,3,3,1,4 +167528,4,1,1,1,2,1,3,6,1,2 +169356,3,1,1,1,2,?,3,1,1,2 +183913,1,2,2,1,2,1,1,1,1,2 +191250,10,4,4,10,2,10,5,3,3,4 +1017023,6,3,3,5,3,10,3,5,3,2 +1100524,6,10,10,2,8,10,7,3,3,4 +1116116,9,10,10,1,10,8,3,3,1,4 +1168736,5,6,6,2,4,10,3,6,1,4 +1182404,3,1,1,1,2,1,1,1,1,2 +1182404,3,1,1,1,2,1,2,1,1,2 +1198641,3,1,1,1,2,1,3,1,1,2 +242970,5,7,7,1,5,8,3,4,1,2 +255644,10,5,8,10,3,10,5,1,3,4 +263538,5,10,10,6,10,10,10,6,5,4 +274137,8,8,9,4,5,10,7,8,1,4 +303213,10,4,4,10,6,10,5,5,1,4 +314428,7,9,4,10,10,3,5,3,3,4 +1182404,5,1,4,1,2,1,3,2,1,2 +1198641,10,10,6,3,3,10,4,3,2,4 +320675,3,3,5,2,3,10,7,1,1,4 +324427,10,8,8,2,3,4,8,7,8,4 +385103,1,1,1,1,2,1,3,1,1,2 +390840,8,4,7,1,3,10,3,9,2,4 +411453,5,1,1,1,2,1,3,1,1,2 +320675,3,3,5,2,3,10,7,1,1,4 +428903,7,2,4,1,3,4,3,3,1,4 +431495,3,1,1,1,2,1,3,2,1,2 +432809,3,1,3,1,2,?,2,1,1,2 +434518,3,1,1,1,2,1,2,1,1,2 +452264,1,1,1,1,2,1,2,1,1,2 +456282,1,1,1,1,2,1,3,1,1,2 +476903,10,5,7,3,3,7,3,3,8,4 +486283,3,1,1,1,2,1,3,1,1,2 +486662,2,1,1,2,2,1,3,1,1,2 +488173,1,4,3,10,4,10,5,6,1,4 +492268,10,4,6,1,2,10,5,3,1,4 +508234,7,4,5,10,2,10,3,8,2,4 +527363,8,10,10,10,8,10,10,7,3,4 +529329,10,10,10,10,10,10,4,10,10,4 +535331,3,1,1,1,3,1,2,1,1,2 +543558,6,1,3,1,4,5,5,10,1,4 +555977,5,6,6,8,6,10,4,10,4,4 +560680,1,1,1,1,2,1,1,1,1,2 +561477,1,1,1,1,2,1,3,1,1,2 +563649,8,8,8,1,2,?,6,10,1,4 +601265,10,4,4,6,2,10,2,3,1,4 +606140,1,1,1,1,2,?,2,1,1,2 +606722,5,5,7,8,6,10,7,4,1,4 +616240,5,3,4,3,4,5,4,7,1,2 +61634,5,4,3,1,2,?,2,3,1,2 +625201,8,2,1,1,5,1,1,1,1,2 +63375,9,1,2,6,4,10,7,7,2,4 +635844,8,4,10,5,4,4,7,10,1,4 +636130,1,1,1,1,2,1,3,1,1,2 +640744,10,10,10,7,9,10,7,10,10,4 +646904,1,1,1,1,2,1,3,1,1,2 +653777,8,3,4,9,3,10,3,3,1,4 +659642,10,8,4,4,4,10,3,10,4,4 +666090,1,1,1,1,2,1,3,1,1,2 +666942,1,1,1,1,2,1,3,1,1,2 +667204,7,8,7,6,4,3,8,8,4,4 +673637,3,1,1,1,2,5,5,1,1,2 +684955,2,1,1,1,3,1,2,1,1,2 +688033,1,1,1,1,2,1,1,1,1,2 +691628,8,6,4,10,10,1,3,5,1,4 +693702,1,1,1,1,2,1,1,1,1,2 +704097,1,1,1,1,1,1,2,1,1,2 +704168,4,6,5,6,7,?,4,9,1,2 +706426,5,5,5,2,5,10,4,3,1,4 +709287,6,8,7,8,6,8,8,9,1,4 +718641,1,1,1,1,5,1,3,1,1,2 +721482,4,4,4,4,6,5,7,3,1,2 +730881,7,6,3,2,5,10,7,4,6,4 +733639,3,1,1,1,2,?,3,1,1,2 +733639,3,1,1,1,2,1,3,1,1,2 +733823,5,4,6,10,2,10,4,1,1,4 +740492,1,1,1,1,2,1,3,1,1,2 +743348,3,2,2,1,2,1,2,3,1,2 +752904,10,1,1,1,2,10,5,4,1,4 +756136,1,1,1,1,2,1,2,1,1,2 +760001,8,10,3,2,6,4,3,10,1,4 +760239,10,4,6,4,5,10,7,1,1,4 +76389,10,4,7,2,2,8,6,1,1,4 +764974,5,1,1,1,2,1,3,1,2,2 +770066,5,2,2,2,2,1,2,2,1,2 +785208,5,4,6,6,4,10,4,3,1,4 +785615,8,6,7,3,3,10,3,4,2,4 +792744,1,1,1,1,2,1,1,1,1,2 +797327,6,5,5,8,4,10,3,4,1,4 +798429,1,1,1,1,2,1,3,1,1,2 +704097,1,1,1,1,1,1,2,1,1,2 +806423,8,5,5,5,2,10,4,3,1,4 +809912,10,3,3,1,2,10,7,6,1,4 +810104,1,1,1,1,2,1,3,1,1,2 +814265,2,1,1,1,2,1,1,1,1,2 +814911,1,1,1,1,2,1,1,1,1,2 +822829,7,6,4,8,10,10,9,5,3,4 +826923,1,1,1,1,2,1,1,1,1,2 +830690,5,2,2,2,3,1,1,3,1,2 +831268,1,1,1,1,1,1,1,3,1,2 +832226,3,4,4,10,5,1,3,3,1,4 +832567,4,2,3,5,3,8,7,6,1,4 +836433,5,1,1,3,2,1,1,1,1,2 +837082,2,1,1,1,2,1,3,1,1,2 +846832,3,4,5,3,7,3,4,6,1,2 +850831,2,7,10,10,7,10,4,9,4,4 +855524,1,1,1,1,2,1,2,1,1,2 +857774,4,1,1,1,3,1,2,2,1,2 +859164,5,3,3,1,3,3,3,3,3,4 +859350,8,10,10,7,10,10,7,3,8,4 +866325,8,10,5,3,8,4,4,10,3,4 +873549,10,3,5,4,3,7,3,5,3,4 +877291,6,10,10,10,10,10,8,10,10,4 +877943,3,10,3,10,6,10,5,1,4,4 +888169,3,2,2,1,4,3,2,1,1,2 +888523,4,4,4,2,2,3,2,1,1,2 +896404,2,1,1,1,2,1,3,1,1,2 +897172,2,1,1,1,2,1,2,1,1,2 +95719,6,10,10,10,8,10,7,10,7,4 +160296,5,8,8,10,5,10,8,10,3,4 +342245,1,1,3,1,2,1,1,1,1,2 +428598,1,1,3,1,1,1,2,1,1,2 +492561,4,3,2,1,3,1,2,1,1,2 +493452,1,1,3,1,2,1,1,1,1,2 +493452,4,1,2,1,2,1,2,1,1,2 +521441,5,1,1,2,2,1,2,1,1,2 +560680,3,1,2,1,2,1,2,1,1,2 +636437,1,1,1,1,2,1,1,1,1,2 +640712,1,1,1,1,2,1,2,1,1,2 +654244,1,1,1,1,1,1,2,1,1,2 +657753,3,1,1,4,3,1,2,2,1,2 +685977,5,3,4,1,4,1,3,1,1,2 +805448,1,1,1,1,2,1,1,1,1,2 +846423,10,6,3,6,4,10,7,8,4,4 +1002504,3,2,2,2,2,1,3,2,1,2 +1022257,2,1,1,1,2,1,1,1,1,2 +1026122,2,1,1,1,2,1,1,1,1,2 +1071084,3,3,2,2,3,1,1,2,3,2 +1080233,7,6,6,3,2,10,7,1,1,4 +1114570,5,3,3,2,3,1,3,1,1,2 +1114570,2,1,1,1,2,1,2,2,1,2 +1116715,5,1,1,1,3,2,2,2,1,2 +1131411,1,1,1,2,2,1,2,1,1,2 +1151734,10,8,7,4,3,10,7,9,1,4 +1156017,3,1,1,1,2,1,2,1,1,2 +1158247,1,1,1,1,1,1,1,1,1,2 +1158405,1,2,3,1,2,1,2,1,1,2 +1168278,3,1,1,1,2,1,2,1,1,2 +1176187,3,1,1,1,2,1,3,1,1,2 +1196263,4,1,1,1,2,1,1,1,1,2 +1196475,3,2,1,1,2,1,2,2,1,2 +1206314,1,2,3,1,2,1,1,1,1,2 +1211265,3,10,8,7,6,9,9,3,8,4 +1213784,3,1,1,1,2,1,1,1,1,2 +1223003,5,3,3,1,2,1,2,1,1,2 +1223306,3,1,1,1,2,4,1,1,1,2 +1223543,1,2,1,3,2,1,1,2,1,2 +1229929,1,1,1,1,2,1,2,1,1,2 +1231853,4,2,2,1,2,1,2,1,1,2 +1234554,1,1,1,1,2,1,2,1,1,2 +1236837,2,3,2,2,2,2,3,1,1,2 +1237674,3,1,2,1,2,1,2,1,1,2 +1238021,1,1,1,1,2,1,2,1,1,2 +1238464,1,1,1,1,1,?,2,1,1,2 +1238633,10,10,10,6,8,4,8,5,1,4 +1238915,5,1,2,1,2,1,3,1,1,2 +1238948,8,5,6,2,3,10,6,6,1,4 +1239232,3,3,2,6,3,3,3,5,1,2 +1239347,8,7,8,5,10,10,7,2,1,4 +1239967,1,1,1,1,2,1,2,1,1,2 +1240337,5,2,2,2,2,2,3,2,2,2 +1253505,2,3,1,1,5,1,1,1,1,2 +1255384,3,2,2,3,2,3,3,1,1,2 +1257200,10,10,10,7,10,10,8,2,1,4 +1257648,4,3,3,1,2,1,3,3,1,2 +1257815,5,1,3,1,2,1,2,1,1,2 +1257938,3,1,1,1,2,1,1,1,1,2 +1258549,9,10,10,10,10,10,10,10,1,4 +1258556,5,3,6,1,2,1,1,1,1,2 +1266154,8,7,8,2,4,2,5,10,1,4 +1272039,1,1,1,1,2,1,2,1,1,2 +1276091,2,1,1,1,2,1,2,1,1,2 +1276091,1,3,1,1,2,1,2,2,1,2 +1276091,5,1,1,3,4,1,3,2,1,2 +1277629,5,1,1,1,2,1,2,2,1,2 +1293439,3,2,2,3,2,1,1,1,1,2 +1293439,6,9,7,5,5,8,4,2,1,2 +1294562,10,8,10,1,3,10,5,1,1,4 +1295186,10,10,10,1,6,1,2,8,1,4 +527337,4,1,1,1,2,1,1,1,1,2 +558538,4,1,3,3,2,1,1,1,1,2 +566509,5,1,1,1,2,1,1,1,1,2 +608157,10,4,3,10,4,10,10,1,1,4 +677910,5,2,2,4,2,4,1,1,1,2 +734111,1,1,1,3,2,3,1,1,1,2 +734111,1,1,1,1,2,2,1,1,1,2 +780555,5,1,1,6,3,1,2,1,1,2 +827627,2,1,1,1,2,1,1,1,1,2 +1049837,1,1,1,1,2,1,1,1,1,2 +1058849,5,1,1,1,2,1,1,1,1,2 +1182404,1,1,1,1,1,1,1,1,1,2 +1193544,5,7,9,8,6,10,8,10,1,4 +1201870,4,1,1,3,1,1,2,1,1,2 +1202253,5,1,1,1,2,1,1,1,1,2 +1227081,3,1,1,3,2,1,1,1,1,2 +1230994,4,5,5,8,6,10,10,7,1,4 +1238410,2,3,1,1,3,1,1,1,1,2 +1246562,10,2,2,1,2,6,1,1,2,4 +1257470,10,6,5,8,5,10,8,6,1,4 +1259008,8,8,9,6,6,3,10,10,1,4 +1266124,5,1,2,1,2,1,1,1,1,2 +1267898,5,1,3,1,2,1,1,1,1,2 +1268313,5,1,1,3,2,1,1,1,1,2 +1268804,3,1,1,1,2,5,1,1,1,2 +1276091,6,1,1,3,2,1,1,1,1,2 +1280258,4,1,1,1,2,1,1,2,1,2 +1293966,4,1,1,1,2,1,1,1,1,2 +1296572,10,9,8,7,6,4,7,10,3,4 +1298416,10,6,6,2,4,10,9,7,1,4 +1299596,6,6,6,5,4,10,7,6,2,4 +1105524,4,1,1,1,2,1,1,1,1,2 +1181685,1,1,2,1,2,1,2,1,1,2 +1211594,3,1,1,1,1,1,2,1,1,2 +1238777,6,1,1,3,2,1,1,1,1,2 +1257608,6,1,1,1,1,1,1,1,1,2 +1269574,4,1,1,1,2,1,1,1,1,2 +1277145,5,1,1,1,2,1,1,1,1,2 +1287282,3,1,1,1,2,1,1,1,1,2 +1296025,4,1,2,1,2,1,1,1,1,2 +1296263,4,1,1,1,2,1,1,1,1,2 +1296593,5,2,1,1,2,1,1,1,1,2 +1299161,4,8,7,10,4,10,7,5,1,4 +1301945,5,1,1,1,1,1,1,1,1,2 +1302428,5,3,2,4,2,1,1,1,1,2 +1318169,9,10,10,10,10,5,10,10,10,4 +474162,8,7,8,5,5,10,9,10,1,4 +787451,5,1,2,1,2,1,1,1,1,2 +1002025,1,1,1,3,1,3,1,1,1,2 +1070522,3,1,1,1,1,1,2,1,1,2 +1073960,10,10,10,10,6,10,8,1,5,4 +1076352,3,6,4,10,3,3,3,4,1,4 +1084139,6,3,2,1,3,4,4,1,1,4 +1115293,1,1,1,1,2,1,1,1,1,2 +1119189,5,8,9,4,3,10,7,1,1,4 +1133991,4,1,1,1,1,1,2,1,1,2 +1142706,5,10,10,10,6,10,6,5,2,4 +1155967,5,1,2,10,4,5,2,1,1,2 +1170945,3,1,1,1,1,1,2,1,1,2 +1181567,1,1,1,1,1,1,1,1,1,2 +1182404,4,2,1,1,2,1,1,1,1,2 +1204558,4,1,1,1,2,1,2,1,1,2 +1217952,4,1,1,1,2,1,2,1,1,2 +1224565,6,1,1,1,2,1,3,1,1,2 +1238186,4,1,1,1,2,1,2,1,1,2 +1253917,4,1,1,2,2,1,2,1,1,2 +1265899,4,1,1,1,2,1,3,1,1,2 +1268766,1,1,1,1,2,1,1,1,1,2 +1277268,3,3,1,1,2,1,1,1,1,2 +1286943,8,10,10,10,7,5,4,8,7,4 +1295508,1,1,1,1,2,4,1,1,1,2 +1297327,5,1,1,1,2,1,1,1,1,2 +1297522,2,1,1,1,2,1,1,1,1,2 +1298360,1,1,1,1,2,1,1,1,1,2 +1299924,5,1,1,1,2,1,2,1,1,2 +1299994,5,1,1,1,2,1,1,1,1,2 +1304595,3,1,1,1,1,1,2,1,1,2 +1306282,6,6,7,10,3,10,8,10,2,4 +1313325,4,10,4,7,3,10,9,10,1,4 +1320077,1,1,1,1,1,1,1,1,1,2 +1320077,1,1,1,1,1,1,2,1,1,2 +1320304,3,1,2,2,2,1,1,1,1,2 +1330439,4,7,8,3,4,10,9,1,1,4 +333093,1,1,1,1,3,1,1,1,1,2 +369565,4,1,1,1,3,1,1,1,1,2 +412300,10,4,5,4,3,5,7,3,1,4 +672113,7,5,6,10,4,10,5,3,1,4 +749653,3,1,1,1,2,1,2,1,1,2 +769612,3,1,1,2,2,1,1,1,1,2 +769612,4,1,1,1,2,1,1,1,1,2 +798429,4,1,1,1,2,1,3,1,1,2 +807657,6,1,3,2,2,1,1,1,1,2 +8233704,4,1,1,1,1,1,2,1,1,2 +837480,7,4,4,3,4,10,6,9,1,4 +867392,4,2,2,1,2,1,2,1,1,2 +869828,1,1,1,1,1,1,3,1,1,2 +1043068,3,1,1,1,2,1,2,1,1,2 +1056171,2,1,1,1,2,1,2,1,1,2 +1061990,1,1,3,2,2,1,3,1,1,2 +1113061,5,1,1,1,2,1,3,1,1,2 +1116192,5,1,2,1,2,1,3,1,1,2 +1135090,4,1,1,1,2,1,2,1,1,2 +1145420,6,1,1,1,2,1,2,1,1,2 +1158157,5,1,1,1,2,2,2,1,1,2 +1171578,3,1,1,1,2,1,1,1,1,2 +1174841,5,3,1,1,2,1,1,1,1,2 +1184586,4,1,1,1,2,1,2,1,1,2 +1186936,2,1,3,2,2,1,2,1,1,2 +1197527,5,1,1,1,2,1,2,1,1,2 +1222464,6,10,10,10,4,10,7,10,1,4 +1240603,2,1,1,1,1,1,1,1,1,2 +1240603,3,1,1,1,1,1,1,1,1,2 +1241035,7,8,3,7,4,5,7,8,2,4 +1287971,3,1,1,1,2,1,2,1,1,2 +1289391,1,1,1,1,2,1,3,1,1,2 +1299924,3,2,2,2,2,1,4,2,1,2 +1306339,4,4,2,1,2,5,2,1,2,2 +1313658,3,1,1,1,2,1,1,1,1,2 +1313982,4,3,1,1,2,1,4,8,1,2 +1321264,5,2,2,2,1,1,2,1,1,2 +1321321,5,1,1,3,2,1,1,1,1,2 +1321348,2,1,1,1,2,1,2,1,1,2 +1321931,5,1,1,1,2,1,2,1,1,2 +1321942,5,1,1,1,2,1,3,1,1,2 +1321942,5,1,1,1,2,1,3,1,1,2 +1328331,1,1,1,1,2,1,3,1,1,2 +1328755,3,1,1,1,2,1,2,1,1,2 +1331405,4,1,1,1,2,1,3,2,1,2 +1331412,5,7,10,10,5,10,10,10,1,4 +1333104,3,1,2,1,2,1,3,1,1,2 +1334071,4,1,1,1,2,3,2,1,1,2 +1343068,8,4,4,1,6,10,2,5,2,4 +1343374,10,10,8,10,6,5,10,3,1,4 +1344121,8,10,4,4,8,10,8,2,1,4 +142932,7,6,10,5,3,10,9,10,2,4 +183936,3,1,1,1,2,1,2,1,1,2 +324382,1,1,1,1,2,1,2,1,1,2 +378275,10,9,7,3,4,2,7,7,1,4 +385103,5,1,2,1,2,1,3,1,1,2 +690557,5,1,1,1,2,1,2,1,1,2 +695091,1,1,1,1,2,1,2,1,1,2 +695219,1,1,1,1,2,1,2,1,1,2 +824249,1,1,1,1,2,1,3,1,1,2 +871549,5,1,2,1,2,1,2,1,1,2 +878358,5,7,10,6,5,10,7,5,1,4 +1107684,6,10,5,5,4,10,6,10,1,4 +1115762,3,1,1,1,2,1,1,1,1,2 +1217717,5,1,1,6,3,1,1,1,1,2 +1239420,1,1,1,1,2,1,1,1,1,2 +1254538,8,10,10,10,6,10,10,10,1,4 +1261751,5,1,1,1,2,1,2,2,1,2 +1268275,9,8,8,9,6,3,4,1,1,4 +1272166,5,1,1,1,2,1,1,1,1,2 +1294261,4,10,8,5,4,1,10,1,1,4 +1295529,2,5,7,6,4,10,7,6,1,4 +1298484,10,3,4,5,3,10,4,1,1,4 +1311875,5,1,2,1,2,1,1,1,1,2 +1315506,4,8,6,3,4,10,7,1,1,4 +1320141,5,1,1,1,2,1,2,1,1,2 +1325309,4,1,2,1,2,1,2,1,1,2 +1333063,5,1,3,1,2,1,3,1,1,2 +1333495,3,1,1,1,2,1,2,1,1,2 +1334659,5,2,4,1,1,1,1,1,1,2 +1336798,3,1,1,1,2,1,2,1,1,2 +1344449,1,1,1,1,1,1,2,1,1,2 +1350568,4,1,1,1,2,1,2,1,1,2 +1352663,5,4,6,8,4,1,8,10,1,4 +188336,5,3,2,8,5,10,8,1,2,4 +352431,10,5,10,3,5,8,7,8,3,4 +353098,4,1,1,2,2,1,1,1,1,2 +411453,1,1,1,1,2,1,1,1,1,2 +557583,5,10,10,10,10,10,10,1,1,4 +636375,5,1,1,1,2,1,1,1,1,2 +736150,10,4,3,10,3,10,7,1,2,4 +803531,5,10,10,10,5,2,8,5,1,4 +822829,8,10,10,10,6,10,10,10,10,4 +1016634,2,3,1,1,2,1,2,1,1,2 +1031608,2,1,1,1,1,1,2,1,1,2 +1041043,4,1,3,1,2,1,2,1,1,2 +1042252,3,1,1,1,2,1,2,1,1,2 +1057067,1,1,1,1,1,?,1,1,1,2 +1061990,4,1,1,1,2,1,2,1,1,2 +1073836,5,1,1,1,2,1,2,1,1,2 +1083817,3,1,1,1,2,1,2,1,1,2 +1096352,6,3,3,3,3,2,6,1,1,2 +1140597,7,1,2,3,2,1,2,1,1,2 +1149548,1,1,1,1,2,1,1,1,1,2 +1174009,5,1,1,2,1,1,2,1,1,2 +1183596,3,1,3,1,3,4,1,1,1,2 +1190386,4,6,6,5,7,6,7,7,3,4 +1190546,2,1,1,1,2,5,1,1,1,2 +1213273,2,1,1,1,2,1,1,1,1,2 +1218982,4,1,1,1,2,1,1,1,1,2 +1225382,6,2,3,1,2,1,1,1,1,2 +1235807,5,1,1,1,2,1,2,1,1,2 +1238777,1,1,1,1,2,1,1,1,1,2 +1253955,8,7,4,4,5,3,5,10,1,4 +1257366,3,1,1,1,2,1,1,1,1,2 +1260659,3,1,4,1,2,1,1,1,1,2 +1268952,10,10,7,8,7,1,10,10,3,4 +1275807,4,2,4,3,2,2,2,1,1,2 +1277792,4,1,1,1,2,1,1,1,1,2 +1277792,5,1,1,3,2,1,1,1,1,2 +1285722,4,1,1,3,2,1,1,1,1,2 +1288608,3,1,1,1,2,1,2,1,1,2 +1290203,3,1,1,1,2,1,2,1,1,2 +1294413,1,1,1,1,2,1,1,1,1,2 +1299596,2,1,1,1,2,1,1,1,1,2 +1303489,3,1,1,1,2,1,2,1,1,2 +1311033,1,2,2,1,2,1,1,1,1,2 +1311108,1,1,1,3,2,1,1,1,1,2 +1315807,5,10,10,10,10,2,10,10,10,4 +1318671,3,1,1,1,2,1,2,1,1,2 +1319609,3,1,1,2,3,4,1,1,1,2 +1323477,1,2,1,3,2,1,2,1,1,2 +1324572,5,1,1,1,2,1,2,2,1,2 +1324681,4,1,1,1,2,1,2,1,1,2 +1325159,3,1,1,1,2,1,3,1,1,2 +1326892,3,1,1,1,2,1,2,1,1,2 +1330361,5,1,1,1,2,1,2,1,1,2 +1333877,5,4,5,1,8,1,3,6,1,2 +1334015,7,8,8,7,3,10,7,2,3,4 +1334667,1,1,1,1,2,1,1,1,1,2 +1339781,1,1,1,1,2,1,2,1,1,2 +1339781,4,1,1,1,2,1,3,1,1,2 +13454352,1,1,3,1,2,1,2,1,1,2 +1345452,1,1,3,1,2,1,2,1,1,2 +1345593,3,1,1,3,2,1,2,1,1,2 +1347749,1,1,1,1,2,1,1,1,1,2 +1347943,5,2,2,2,2,1,1,1,2,2 +1348851,3,1,1,1,2,1,3,1,1,2 +1350319,5,7,4,1,6,1,7,10,3,4 +1350423,5,10,10,8,5,5,7,10,1,4 +1352848,3,10,7,8,5,8,7,4,1,4 +1353092,3,2,1,2,2,1,3,1,1,2 +1354840,2,1,1,1,2,1,3,1,1,2 +1354840,5,3,2,1,3,1,1,1,1,2 +1355260,1,1,1,1,2,1,2,1,1,2 +1365075,4,1,4,1,2,1,1,1,1,2 +1365328,1,1,2,1,2,1,2,1,1,2 +1368267,5,1,1,1,2,1,1,1,1,2 +1368273,1,1,1,1,2,1,1,1,1,2 +1368882,2,1,1,1,2,1,1,1,1,2 +1369821,10,10,10,10,5,10,10,10,7,4 +1371026,5,10,10,10,4,10,5,6,3,4 +1371920,5,1,1,1,2,1,3,2,1,2 +466906,1,1,1,1,2,1,1,1,1,2 +466906,1,1,1,1,2,1,1,1,1,2 +534555,1,1,1,1,2,1,1,1,1,2 +536708,1,1,1,1,2,1,1,1,1,2 +566346,3,1,1,1,2,1,2,3,1,2 +603148,4,1,1,1,2,1,1,1,1,2 +654546,1,1,1,1,2,1,1,1,8,2 +654546,1,1,1,3,2,1,1,1,1,2 +695091,5,10,10,5,4,5,4,4,1,4 +714039,3,1,1,1,2,1,1,1,1,2 +763235,3,1,1,1,2,1,2,1,2,2 +776715,3,1,1,1,3,2,1,1,1,2 +841769,2,1,1,1,2,1,1,1,1,2 +888820,5,10,10,3,7,3,8,10,2,4 +897471,4,8,6,4,3,4,10,6,1,4 +897471,4,8,8,5,4,5,10,4,1,4 From a6bbe66b8a5d495c4c6badb1465b1b09782a34da Mon Sep 17 00:00:00 2001 From: Favour James <63251266+Favourj-bit@users.noreply.github.com> Date: Sat, 17 Jul 2021 22:03:26 +0100 Subject: [PATCH 2/4] updated readme --- James, Favour Utibe/README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/James, Favour Utibe/README.md b/James, Favour Utibe/README.md index 53e08fa..f9dfd72 100644 --- a/James, Favour Utibe/README.md +++ b/James, Favour Utibe/README.md @@ -2,23 +2,40 @@ KNN stands for K-Nearest Neighbors. The k-nearest neighbors algorithm uses a very simple approach to perform classification. When tested with a new example, it looks through the training data and finds the k training examples that are closest to the new example. It then assigns the most common class label (among those k-training examples) to the test example. k in the kNN algorithm represents the number of nearest neighbor points which are voting for the new test data’s class. + If k=1, then test examples are given the same label as the closest example in the training set. If k=3, the labels of the three closest classes are checked and the most common (i.e., occurring at least twice) label is assigned, and so on for larger ks. + To calculate the distance between the points, different types of distance metrics can be used such as euclidean distance, cosine distance, and so on, though the euclidean distance is most widely used because it still functions better on most datasets and that is what is used in the sklearn module. How the algorithm functions -In this algorithm, I made use of the euclidean distance. Euclidean distance is just a straight-line distance between two data points in Euclidean space[1]. It can be calculated as follows: + +In this algorithm, I made use of the euclidean distance. + +Euclidean distance is just a straight-line distance between two data points in Euclidean space[1]. It can be calculated as follows: d(x,y) = ((x1 - y1)² + (x2 - y2)² + ... + (xn - yn)²)½ But this way of calculating distance accounts for only 2-dimensional points, in the case of 3-dimensional points, it won't function well. In my code, I made use of the numpy method of calculating distances and this also accounts for 3-dimensional points. Algorithm Implementation + k: value for k train_set: entire list with values for training the algorithm test_set: entire list with values for testing the algorithm Steps to follow: + 1. Calculate Euclidean distance between the test_instanceand each row of the train_set 2. Sort the distances by distance value, from lowest to highest 3. Keep the distance of the smallest ones 4. Get values of a target variable for k train_set rows with the smallest distance 5. Whichever target variable class has the majority, wins +This code is made up of 2 main functions: + +1. getPredictions: This function is written to calculate the euclidean distance between the data points, get the nearest neighbors according to which is nearest to the point and select the most common class of the nearest neighbors. + +2. evaluate: This function is written to test the algorithm using the train and test sets. + + + + + From 75a730aa37d550bf3873fb331eb11a3040644206 Mon Sep 17 00:00:00 2001 From: Favour James <63251266+Favourj-bit@users.noreply.github.com> Date: Sat, 17 Jul 2021 22:07:19 +0100 Subject: [PATCH 3/4] rd --- James, Favour Utibe/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/James, Favour Utibe/README.md b/James, Favour Utibe/README.md index f9dfd72..f060b4e 100644 --- a/James, Favour Utibe/README.md +++ b/James, Favour Utibe/README.md @@ -12,7 +12,9 @@ How the algorithm functions In this algorithm, I made use of the euclidean distance. Euclidean distance is just a straight-line distance between two data points in Euclidean space[1]. It can be calculated as follows: + d(x,y) = ((x1 - y1)² + (x2 - y2)² + ... + (xn - yn)²)½ + But this way of calculating distance accounts for only 2-dimensional points, in the case of 3-dimensional points, it won't function well. In my code, I made use of the numpy method of calculating distances and this also accounts for 3-dimensional points. Algorithm Implementation From 3064660aaf223742db3dcb5e7e8af3cb916e84f4 Mon Sep 17 00:00:00 2001 From: Favour James <63251266+Favourj-bit@users.noreply.github.com> Date: Tue, 28 Mar 2023 16:32:09 +0100 Subject: [PATCH 4/4] Create README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c8162f --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# ML-Algorithm-Challenge + +This project was done to participate in a competiotion. We were required to build the K-Nearest neighbors algorithm from scratch using Python. +I used Python, the idea behind the project is in the package ReadMe +I emerged as second at the end of the competition period