def regressorOp(x, y):
"""
This will optimize the parameters for the algo
"""
regr_rbf = svm.SVR(kernel="rbf")
C = [1000, 10, 1]
gamma = [0.005, 0.004, 0.003, 0.002, 0.001]
epsilon = [0.1, 0.01]
parameters = {"C":C, "gamma":gamma, "epsilon":epsilon}
gs = grid_search.GridSearchCV(regr_rbf, parameters, scoring="r2")
gs.fit(x, y)
print "Best Estimator:\n", gs.best_estimator_
print "Type: ", type(gs.best_estimator_)
return gs.best_estimator_
评论列表
文章目录