1,908 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.7k
14.7k views
tofighi asked Jan 27, 2020
14,650 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.9k
7.9k views
tofighi asked Feb 3, 2020
7,937 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
579
579 views
Ziva asked Aug 6, 2020
579 views
0 0 votes
0 0 answers
642
642 views
Ziva asked Jul 30, 2020
642 views
3 3 votes
1 1 answer
1.1k
1.1k views
Neo asked Oct 7, 2018
1,129 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 ...