sklearn.grid_search.GridSearchCV(estimator,
param_grid, scoring=None, fit_params=None,
n_jobs=1, iid=True, refit=True, cv=None,
verbose=0, pre_dispatch='2*n_jobs', error_score='raise')
应用:
clf6=NuSVR(nu=0.5, C=1.0, kernel='rbf', degree=3, gamma='auto', coef0=0.0,
shrinking=True, tol=0.001, cache_size=200, verbose=False, max_iter=-1)param_test1 = {'C':arange(0.1,1.1,0.1),'gamma':arange(0.0001,0.001,0.0001)}
gsearch1 = GridSearchCV(estimator = clf6,
param_grid = param_test1, scoring='mean_squared_error',iid=False,cv=5)
gsearch1.fit(train_x,train_raw_y)
print(gsearch1.grid_scores_, gsearch1.best_params_, gsearch1.best_score_)