Invalid Parameter Loss For Estimator Svr
This is my code i used grid search cv for hyper parameter tuning. but it shows error. param_grid = {'kernel' : ['linear', 'poly', 'rbf', 'sigmoid'], 'loss' : ['epsilon_
Solution 1:
Some errors that I spotted:
You seem to be specifying a
loss
parameter and possible values, that are only defined for aLinearSVR
, not aSVR
. On another hand, if you do want to use aLinearSVR
, you can't specify a kernel, since it has to be linear.I also noticed that
'C' : [np.arange(0,20,1)]
in the definition of the grid will yield an error, since it results in a nested list. Just usenp.arange(0,20,1)
Assuming then you have a SVR
, the following should work for you:
from sklearn.svm importSVRsvr= SVR()
param_grid = {"kernel" : ['linear', 'poly', 'rbf', 'sigmoid'],
"max_iter" : [1,10,20],
'C' : np.arange(0,20,1)}
model = GridSearchCV(estimator = svr, param_grid = param_grid,
cv = 5, verbose = 3, n_jobs = -1)
m1 = model.fit(X_train, y_train)
Post a Comment for "Invalid Parameter Loss For Estimator Svr"