Python Machine Learning
Grid Search
Hyperparameter tuning
Grid Search
The majority of machine learning models contain parameters that can be adjusted to vary how the model learns. These parameters are called hyperparameters.
Grid Search Example
from sklearn import svm, datasets
from sklearn.model_selection import GridSearchCV
iris = datasets.load_iris()
parameters = {'kernel':('linear', 'rbf'), 'C':[1, 10]}
svc = svm.SVC()
clf = GridSearchCV(svc, parameters)
clf.fit(iris.data, iris.target)
print(clf.best_params_)