I'm trying to find the parameters for my SVM, which give me the best AUC. But i can't find any scoring function for AUC in sklearn. Does someone have an idea? Here is my Code:
parameters = {"C":[0.1, 1, 10, 100, 1000], "gamma":[0.1, 0.01, 0.001, 0.0001, 0.00001]}
clf = SVC(kernel = "rbf")
clf = GridSearchCV(clf, parameters, scoring = ???)
svr.fit(features_train , labels_train)
print svr.best_params_
So what can i use for ??? to get the best parameters for an high AUC score?
The parameter grid to explore, as a dictionary mapping estimator parameters to sequences of allowed values. An empty dict signifies default parameters. A sequence of dicts signifies a sequence of grids to search, and is useful to avoid exploring parameter combinations that make no sense or have no effect.
Grid Search CV: Grid Search cross-validation is a technique to select the best of the machine learning model, parameterized by a grid of hyperparameters. Scikit-Learn library comes with grid search cross-validation implementation.
As documented here, C is inverse of regularization, the larger the C, the smaller is regularization, means that your algo is more prone to overfit the data.
You can simply use:
clf = GridSearchCV(clf, parameters, scoring='roc_auc')
use below code which will give you all the list of parameter
import sklearn
sklearn.metrics.SCORERS.keys()
Select appropriate parameter that you want to use
In your case below code will work
clf = GridSearchCV(clf, parameters, scoring = 'roc_auc')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With