can we search for the kernel in Gridserach as below:
and what parameters combinations we should avoid?
parameters = {'C': [0.1, 1, 10, 100, 1000],
'gamma': [1, 0.1, 0.01, 0.001, 0.0001,'auto'],
'kernel': ['linear', 'poly', 'rbf', 'sigmoid']}
Svm = GridSearchCV(Svm, param_grid=parameters, cv=kf,verbose=10)
In principle, you can search for the kernel in GridSearch. But you should keep in mind that
'gamma'is only useful for‘rbf’,‘poly’and‘sigmoid’. That means You will have redundant calculation when'kernel'is'linear'. The better way is to use a list of dictionaries rather than a dictionary as an input parameter ofparam_grid:You could find the similar parameters setting in the scikit-learn document: https://scikit-learn.org/stable/auto_examples/model_selection/plot_grid_search_digits.html
I hop this answer is useful for you. :)