1,776 views
0 0 votes

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)
0% Accept Rate Accepted 0 answers out of 1 questions

1 Answer

0 0 votes
 
from sklearn.metrics import f1_score
f1_score(data_test,target_test)

Related questions

2 2 votes
1 answers 1 answer
14.3k
14.3k views
tofighi asked Jan 27, 2020
14,277 views
In the following example, calculate Accuracy, Precision, Recall or F1?https://i.imgur.com/OezFpqC.png
3 3 votes
1 answers 1 answer
7.8k
7.8k views
tofighi asked Feb 3, 2020
7,788 views
How to solve this problem?https://i.imgur.com/8urywpf.jpgQ1) Complete the ? sectionsQ2) Accuracy of system if threshold = 0.5?Q3) Accuracy of system if threshold = 0.95?
1 1 vote
0 0 answers
528
528 views
Ziva asked Aug 6, 2020
528 views
0 0 votes
0 0 answers
584
584 views
Ziva asked Jul 30, 2020
584 views
3 3 votes
1 1 answer
978
978 views
Neo asked Oct 7, 2018
978 views
I am wondering why should we use machine learning instead of deep learning. We know that deep learning is very powerful. Anything which machine learning algorithm can do ...