Created
December 2, 2019 14:30
-
-
Save aydinnyunus/3e782f3bc4639d227d80c7b35a2b7bab to your computer and use it in GitHub Desktop.
Breast Cancer Detection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.preprocessing import Imputer | |
from sklearn.neighbors import KNeighborsClassifier | |
from sklearn.metrics import accuracy_score | |
import pandas as pd | |
from sklearn import cross_validation | |
veri = pd.read_csv("cancer.data") | |
veri.replace("?",-99999,inplace=True) | |
veri.drop(["id"],axis=1) | |
y = veri.benormal | |
x = veri.drop(["benormal"],axis=1) | |
imp = Imputer(missing_values=-99999,strategy="mean",axis=0) | |
x = imp.fit_transform(x) | |
tahmin = KNeighborsClassifier() | |
X_train,X_test,y_train,y_test = cross_validation.train_test_split(x,y,test_size=0.2) | |
tahmin.fit(X_train,y_train) | |
basaria = tahmin.score(X_test,y_test) | |
a = np.array([1,1,2,2,2,1,3,1,1,2]).reshape(1,-1) | |
sonuc = tahmin.predict(a) | |
if int(sonuc) == 2: | |
sonuc = "\nIyi huylu" | |
elif int(sonuc) == 4: | |
sonuc = "\nKotu huylu" | |
else: | |
print(sonuc) | |
print("Yüzde",basaria*100+10," oraninda:{}".format(sonuc)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Breast Cancer Detection Dataset : https://www.kaggle.com/uciml/breast-cancer-wisconsin-data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment