0

I have dataset X_train , y_train , X_test, y_test. Now I want to train logistic regression with K=10 Cross validation . Same time I would like to have F1 score and accuracy for each fold. But I would also like to set threshold of probability lets's to .65.

from sklearn.linear_model import LogisticRegression
clf = LogisticRegression()

How can be done this in single line with sklearn.model_selection.cross_validate or sklearn.model_selection.cross_val_score

Thanks in advance

Bharat Sharma
  • 1,081
  • 3
  • 11
  • 23
  • No. Using sklearn.model_selection import cross_validate I can get F1 score for each fold but I want to do it using a threshold probability which i set. – Bharat Sharma Mar 18 '20 at 10:11
  • I pasted the wrong one sorry, I think this is the one https://stackoverflow.com/questions/31417487/sklearn-logisticregression-and-changing-the-default-threshold-for-classification/52253597 – Justice_Lords Mar 18 '20 at 10:15
  • I think here too I got another answer https://stackoverflow.com/questions/41458834/how-is-scikit-learn-cross-val-predict-accuracy-score-calculated . Thanks – Bharat Sharma Mar 18 '20 at 10:19

0 Answers0