반응형
GridSearchCV
hyper parameter 하이퍼파라미터
사람이 설정해줘야 되는 값이고,
어떤 값을 설정해야 똑똑한 인공지능이 나올지는 아무도 모른다.
param_grid = { 'C' : [0.1, 1, 10, 100] , 'kernel' : ['linear', 'rdf', 'poly'], 'gamma' : [1, 0.1, 0.01]}
from sklearn.model_selection import GridSearchCV
grid = GridSearchCV( SVC() , param_grid , refit=True, verbose=4 )
grid.fit(X_train, y_train)
best_classifier = grid.best_estimator_
y_pred = best_classifier.predict(X_test)
confusion_matrix(y_test, y_pred)

accuracy_score(y_test, y_pred)

grid.best_params_

grid.best_score_

위 예시와 같이 사람이 설정한 값
즉, GridSearchCV와 Hyper Parameter 설정을 통해
가장 좋은 조합의 인공지능을 가져올 수 있고
가장 좋은 모델에 사용된 하이퍼 파라미터를 알아볼수도 잇다.
반응형
'Machine Learning' 카테고리의 다른 글
| Machine Learning - CountVectorizer (analyzer) (0) | 2022.05.11 |
|---|---|
| Machine Learning - 구두점 & STOPWORDS(불용어) & Pipe Lining (0) | 2022.05.11 |
| Machine Learning - Word Cloud (Stopwords) (0) | 2022.05.09 |
| Machine Learning - Hierarchical Clustering (Dendrogram) (0) | 2022.05.09 |
| Machine Learning - K-Means Clustering (wcss & elbow method) (0) | 2022.05.09 |