import numpy as np
from sklearn import preprocessing  , neighbors 
from sklearn.model_selection import train_test_split
import pandas as pd


df = pd.read_csv('breast-cancer-wisconsin.data',names=['id','m1','m2','m3','m4','m5','m6','m7','m8','m9','class'])

df.replace('?' , -99999 , inplace=True)

df.drop(['id'],axis=1,inplace=True)

print(df.head)

x = np.array(df.drop(['class'],1))

y = np.array(df['class'])

x_train , x_test , y_train , y_test = train_test_split(x,y,test_size=0.2)

clf = neighbors.KNeighborsClassifier()
clf.fit(x_train,y_train)

accuracy = clf.score(x_test,y_test)

print(accuracy)

example_measures = np.array([4,2,1,1,1,2,3,2,1])
example_measures = example_measures.reshape(1,-1)


prediction = clf.predict(example_measures)
print(prediction)