Issue
When I try to fit the training dataset to the GridsearchCV, it states that the scoring must be a str among:
{'jaccard_samples', 'precision_macro', 'balanced_accuracy', ...<long list of allowed classes, see edit history>...},
a callable, an instance of 'list', an instance of 'tuple', an instance of 'dict' or None.
Got {'precision', 'recall', 'accuracy', 'f1'} instead."
Even though my scoring is a list of: "{'precision','f1','recall','accuracy'}"
.
I run the code with the Jupyter kernel extension in VS code. I tried changing it to only go for the scoring of 'Recall' and it worked, however that I would like to have multiple scoring variables.
Solution
The allowed types for scoring
in GridSearchCV are
str, callable, list, tuple or dict,
You are passing a set which is not a valid type.
Use scoring=['precision','f1','recall','accuracy']
with square brackets not curly ones.
To more comprehensive for multiple scoring types you can pass (see linked doc) :
- a list or tuple of unique strings;
- a callable returning a dictionary where the keys are the metric names and the values are the metric scores;
- a dictionary with metric names as keys and callables a values.
Answered By - Daraan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.