Skip to content

Instantly share code, notes, and snippets.

@PhilipPurwoko
Created September 19, 2020 12:50
Show Gist options
  • Save PhilipPurwoko/f213514794250e618e6a62245da92059 to your computer and use it in GitHub Desktop.
Save PhilipPurwoko/f213514794250e618e6a62245da92059 to your computer and use it in GitHub Desktop.
# Menggunakan GridSearchCV untuk menemukan model dengan parameter terbaik
from sklearn.model_selection import GridSearchCV
# SVC Model Hyperparameter
param_grid = {'C':[0.01,0.1,1,10,100],
'gamma':[100,10,1,0,1,0.01]}
# Membuat model terbaik dari semua kemungkinan kombinasi param_grid
best_model = GridSearchCV(SVC(),param_grid,cv=5,refit=True)
# Melatih model terbaik
best_model.fit(x_train,y_train)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment