본문으로 바로가기
728x90

1. 하이퍼파라미터 튜닝

from sklearn.model_selection import GridSearchCV / RandomizedSearchCV

param = {'C': [...]}
search = GridSearchCV(model, param, cv=5) / RandomizedSearch(model, param, cv=5)
search.fit(X_train, y_train)

search.best_params_
search.best_score_

2. 결과 해석

from sklearn.metrics import roc_auc_score
roc = roc_auc_score(y, pred)

from sklearn.metrics import confusion_matrix
confusion = confusion_matrix(y, pred)

from sklearn.metrics import classification_report
report = classification_report(y, pred)

from sklearn.matrics import accuracy_score
accuracy = accuracy_score(y, pred)

from sklearn.matrics import mean_squared_error / mean_absolute_error
mean_error = mean_squared_error(y, pred)
           = mean_absolute_error(y, pred)
728x90