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( sklearn.svm.SVC(probability=True), parameters, n_jobs=64) X, y = sklearn.datasets.samples_generator.make_classification(n_samples=200, n_features=5, random_state=12345) clf.fit(X, y) clf.best_params_
And say you want to take a careful look at the results? They are all in there, too. http://nbviewer.ipython.org/gist/aflaxman/cb0660e602d361d06599