I have a dataset on which I wish to perform multiclass classification using sklearn.linear_model.LogisticRegression()
. After fitting the model, I want to get the precission, recall and f1 score for each of the classes for each fold of cross validation.
According to the docs, there exists sklearn.metrics.precision_recall_fscore_support(), in which I can provide
average=None
as a parameter to get the precision, recall, fscore per class.There exists sklearn.model_selection.cross_val_score(), in which I can provide a custom function in the
scoring
parameter. However, the function has to return a number. In my case, I wish to return a list, which is not possible.There also exists sklearn.model_selection.cross_validate(), in which I can give multiple functions as list to the
scoring
parameter. This would require me to create3*NUMBER_OF_CLASSES
different functions and pass these to thescoring
parameter.
Is there a simpler method available?