1

I want to get the accracy, average_precision, F1, precision, recall and roc_auc scores

I do realise that using the code below, I'll get the average_precision, the problem is when running this code it takes about 20 minute to show the results, is there a better way to get all the scores above in a shorter amount of time ?

clf_svm_2_scores_avg_precision = cross_val_score(clf_svm_2, np.array(x), data['link'], cv=5, scoring='average_precision')

Rishit Dagli
  • 1,000
  • 8
  • 20

1 Answers1

0

Cross validation is generally long, as the training/validation process is generally done several times and then a mean of the scores is calculated. You may try to add the argument n_jobs, in which you have to set the number of cores of your computer.

Catalina Chircu
  • 1,506
  • 2
  • 8
  • 19
  • this is helpful, thank you! i also found out, if you want to get multiple score you can pass in a alist of all the scores in the scoriing param –  Sep 14 '20 at 09:06
  • Now i'm getting UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 due to no predicted samples. 'precision', 'predicted', average, warn_for), the result of all of them is 0, any idea on how to fix this ? Thanks –  Sep 14 '20 at 09:10
  • What did you try in order to fix the second issue ? – Catalina Chircu Sep 14 '20 at 18:14
  • I quit didn't tbh, I added the average param and set it to 'micro' then switched it to 'macro', this way I got different results, way better than 0.0 –  Sep 14 '20 at 20:53
  • Just check if all labels in y_tru appear in y_pred, as indicated in this post : https://stackoverflow.com/questions/43162506 – Catalina Chircu Sep 14 '20 at 22:08