I am trying to model a dataset with RandomForest Classifier.
My dataset has 3 classes viz.
A, B, C.
'A' is the negative class and
'C' are positive classes.
In GridSearch I wanted to optimize on
F1-score since the number of samples in all the classes are not evenly distributed and class
'A' has the highest number of samples.
That is where I wanted to understand the usage of labels argument. The doc says:
labels : list, optional The set of labels to include when average != 'binary', and their order if average is None. Labels present in the data can be excluded, for example to calculate a multiclass average ignoring a majority negative class, while labels not present in the data will result in 0 components in a macro average.
I could not understand it properly. Does it mean, In my screnario I should have labels as
labels = ['B', 'C'], just the positive class?
custom_scoring = make_scorer(f1_score, labels=[???],average='weighted') clf = RandomForestClassifier(class_weight='balanced', random_state=args.random_state) grid_search = GridSearchCV(clf, param_grid=param_grid, n_jobs=20, scoring=custom_scoring)