Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grid-Search finding Parameters for AUC

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?

like image 945
julianspaeth Avatar asked Jun 07 '16 21:06

julianspaeth


People also ask

What are grid parameters?

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.

Does grid search include cross-validation?

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.

What is C value in GridSearchCV?

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.


2 Answers

You can simply use:

clf = GridSearchCV(clf, parameters, scoring='roc_auc')
like image 69
piman314 Avatar answered Sep 17 '22 17:09

piman314


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')
like image 27
Sapan Soni Avatar answered Sep 19 '22 17:09

Sapan Soni