Commit 0ca5cac2 authored by Imanol Perez's avatar Imanol Perez
Browse files

Add threshold to predictions

parent 2d58eedd
......@@ -8,11 +8,10 @@ def evaluate(classifier, features, Y):
print("Evaluating performance...")
#predictions = classifier.predict_proba(features)[:, 1]
#roc = roc_auc_score(Y, predictions)
#print("ROC of predictions: %s"%roc)
predictions = classifier.predict(features)
THRESHOLD = .3
predictions_proba = classifier.predict_proba(features)[:, 1]
predictions = [1. if pred>THRESHOLD else 0. for pred in predictions_proba]
cm = confusion_matrix(Y, predictions)
Se = cm[1, 1] / float(cm[1, 1] + cm[1, 0])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment