Open aboelkassem opened 2 years ago
sklearn
# predict probabilities for test set
yhat_probs = model.predict(testX, verbose=1)
# predict crisp classes for test set
yhat_classes = model.predict_classes(testX, verbose=1)
# accuracy: (tp + tn) / (p + n)
accuracy = accuracy_score(testy, yhat_classes)
print('Accuracy: %f' % accuracy)
# precision tp / (tp + fp)
precision = precision_score(testy, yhat_classes)
print('Precision: %f' % precision)
# recall: tp / (tp + fn)
recall = recall_score(testy, yhat_classes)
print('Recall: %f' % recall)
# f1: 2 tp / (2 tp + fp + fn)
f1 = f1_score(testy, yhat_classes)
print('F1 score: %f' % f1)