You are on page 1of 12

Breast Cancer Detection Using

Python & Machine Learning


Problem Statement

 My aim is to diagnose patients with breast cancer by


analyzing the data of patients and classifying them into
two categories, having diagnosis results as : (1) Benign(B)
and (2) Malignant(M)
Libraries Used
Details of Data
Attributes(Information about Cells)
Clean Data:

 1-No missing attributes


 2-No outliers
 3-No unreliable features  outlier
Bundling the model
Model training
Confusion matrix
predicted

positive
negative positive
positive
Tn Fn
negative

Fn Tp
positive
Precision and Recall

 from sklearn.metrics import classification_report
 from sklearn.metrics import accuracy_score
Precision Recall

How many selected How many relevant for i in range(len(model)):
items are relevant items are selected    print('Model ',i)
Tp/(Tp+Fp) Tp/(Tp+Fn)    #Check precision, recall, f1-score
   print( classification_report(Y_test, model[i].pre
dict(X_test)) )
   #Another way to get the models accuracy on the
 test data
   print( accuracy_score(Y_test, model[i].predict(
X_test)))
   print()#Print a new line
 from sklearn.metrics import classification_report
 from sklearn.metrics import accuracy_score

for i in range(len(model)):
   print('Model ',i)
   #Check precision, recall, f1-score
   print( classification_report(Y_test, model[i].predict(X_test)) )
   #Another way to get the models accuracy on the test data
   print( accuracy_score(Y_test, model[i].predict(X_test)))
   print()#Print a new line

You might also like