I am trying to use OnClassSVM for anomaly detection purpose and I tuned its parameters using GridSearchCV() as follows:
I have searched many sites for it including https://stackoverflow.com/ but could not find any proper solution of my scenario. code is here:
nus = [0.001, 0.01, 0.1, 1]
gammas = [0.001, 0.01, 0.1, 1]
scorers = {
'precision_score': make_scorer(precision_score),
'recall_score': make_scorer(recall_score),
'accuracy_score': make_scorer(accuracy_score)
}
tuned_parameters = {'C': [1, 10, 100, 1000], 'kernel' : ['rbf','linear'],
'gamma' : gammas, 'nu': nus}
tuned_ocsvm = svm.OneClassSVM()
ocsvm = GridSearchCV(estimator=svm.OneClassSVM(),
param_grid=tuned_parameters, scoring=scorers,refit='false')
But it is giving me error as follows
For multi-metric scoring, the parameter refit must be set to a scorer key or a callable to refit an estimator with the best parameter setting on the whole data and make the best_* attributes available for that metric. If this is not needed, refit should be set to False explicitly. 'false' was passed