Breast Cancer Detection Using Python & Machine Learning
Breast Cancer Detection Using Python & Machine Learning
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