def do_svr(X, Y): Y.ravel() """ Call the Support Vector Regressor, Fit the weight on the training set Input ------ X: dataframe, n*m, n is number of data points, m is number of features y: experimental electrical conductivity Returns ------ svr: objective, the regressor objective """ svr = SVR(kernel='rbf', degree=3, gamma='auto', coef0=0.0, tol=0.001, C=1.0, epsilon=0.01, shrinking=True, cache_size=200, verbose=False, max_iter=-1) grid_search = GridSearchCV(svr, cv=5, param_grid={ "C": [1e0, 1e1, 1e2, 1e3], "gamma": np.logspace(-2, 2, 5) }) grid_search.fit(X, Y) svr.alpha_ = grid_search.best_params_['alpha'] svr.fit(X, Y) return svr