First time here? Checkout the FAQ!
x
0 votes
388 views
asked in Python by (120 points)  

I have the code below, outputting the accuracy. How can I output the F1-score instead? Thanks in advance,

 clf.fit(data_train,target_train)  
preds = clf.predict(data_test)  
# accuracy for the current fold only     
r2score = clf.score(data_test,target_test)
  

1 Answer

0 votes
answered by (115k points)  
 
from sklearn.metrics import f1_score
f1_score(data_test,target_test)
...