Issue
I am trying to perform hyper-parameter tuning of my model but this error keeps showing
error : Invalid parameter svc_c for estimator SVC(). Check the list of available parameters with `estimator.get_params().keys()
I am using the following code :
param_grid = {'svc_c': [5, 10, 100],
'svc_gamma': [1,0.1,0.01,0.001],
'svc_dgree': [1,2,3,4,5,6],
'svc_kernel': ['rbf']}
grid = GridSearchCV(SVC(),param_grid,refit=True,verbose=3)
grid.fit(x_train_poly,y_train)
Solution
you need to use the correct key for the dictionary param_grid
.
kernel
, C
, gamma
, degree
and ... (see doc)
try this:
param_grid = {'kernel': ('linear', 'rbf','poly') ,
'C':[5, 10, 100],
'gamma': [1,0.1,0.01,0.001],
'degree' : [1,2,3,4,5,6]}
grid = GridSearchCV(SVC() , param_grid , refit=True , verbose=3)
grid.fit(x_train_poly,y_train)
Answered By - user1740577
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.