I am dealing with multi- OneVsRestClassifier classification with OneVsRestClassifier and SVC ,
from sklearn.datasets import make_multilabel_classification from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import SVC from sklearn.grid_search import GridSearchCV L=3 X, y = make_multilabel_classification(n_classes=L, n_labels=2, allow_unlabeled=True, random_state=1, return_indicator=True) model_to_set = OneVsRestClassifier(SVC()) parameters = { "estimator__C": [1,2,4,8], "estimator__kernel": ["poly","rbf"], "estimator__degree":[1, 2, 3, 4], } model_tunning = GridSearchCV(model_to_set, param_grid=parameters, scoring='f1') model_tunning.fit(X, y) print model_tunning.best_score_ print model_tunning.best_params_
1st question
What is the value of 0.85 to represent? Is this the best indicator among classifiers L or averaged? In the same way, does the parameter set match the top scorer among the L classifiers?
Second question
Based on the fact that, if I'm right, OneVsRestClassifier literally builds L classifiers for each label, you can expect access or monitoring the performance of EACH LABEL. But how in the above example to get L scores from the GridSearchCV object?
EDIT
To simplify the task and help yourself learn more about OneVsRestClassifier , before setting up the model,
model_to_set.fit(X,y) gp = model_to_set.predict(X)
It can be shown that gp.T[0]==fp , gp.T[1]==sp and gp.T[2]==tp . Thus, a โglobalโ prediction is simply โconsecutiveโ L individual predictions and the 2nd question is being solved .
But it still confuses me that if one OneVsRestClassifier metaclassifier contains L classifiers, how GridSearchCV return only one best result corresponding to one of the 4 * 2 * 4 parameter sets, for the OneVsRestClassifier metaclassifier that has L classifiers?
It would be nice to see any comments.