Using the sklearn grid_search tools

Scikit-learn has a really nice grid search module. It will soon be called model_selection, because it has grown beyond simple grid search. But here is the spirit of it:

import sklearn.svm, sklearn.grid_search, sklearn.datasets.samples_generator
parameters = {'kernel':('poly', 'rbf'), 'C':[.01, .1, 1, 10, 100]}
clf = sklearn.grid_search.GridSearchCV(
X, y = sklearn.datasets.samples_generator.make_classification(n_samples=200, n_features=5, random_state=12345), y)

And say you want to take a careful look at the results? They are all in there, too.

Comments Off on Using the sklearn grid_search tools

Filed under machine learning, software engineering

Comments are closed.