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

df = pd.read_csv(u'C:/Users/t430/Desktop/Incentive/RawData/cancer_data.txt')
df.replace('?',-99999,inplace = True)
df.drop(['id'],1,inplace=True)
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)
example_measures = np.array([4,2,1,1,1,2,3,2,1])
example_measures=example_measures.reshape(1,-1)
#print(accuracy)

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