Python에서의 하이퍼파라미터 튜닝
Alex Scriven
Data Scientist
하이퍼파라미터:

간단한 랜덤 포레스트 추정기를 만들고 출력해 봅시다:
rf_clf = RandomForestClassifier() print(rf_clf)RandomForestClassifier(n_estimators='warn', criterion='gini', max_depth=None, max_features='auto', max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, min_samples_leaf=1, min_samples_split=2, min_weight_fraction_leaf=0.0, n_jobs=None, oob_score=False, random_state=None, verbose=0,bootstrap=True, class_weight=None, warm_start=False)
더 알아보기: http://scikit-learn.org
n_estimators 파라미터를 보겠습니다.
자료형 및 기본값:
n_estimators : integer, optional (default=10)
정의:
The number of trees in the forest.
추정기 생성 시 일부 하이퍼파라미터를 설정합니다:
rf_clf = RandomForestClassifier(n_estimators=100, criterion='entropy')
print(rf_clf)
RandomForestClassifier(n_estimators=100, criterion='entropy',
max_depth=None, max_features='auto', max_leaf_nodes=None,
min_impurity_decrease=0.0, min_impurity_split=None,
min_samples_leaf=1, min_samples_split=2,
min_weight_fraction_leaf=0.0, n_jobs=None,
oob_score=False, random_state=None, verbose=0,bootstrap=True,
class_weight=None, warm_start=False)
로지스틱 회귀의 하이퍼파라미터를 확인합니다:
log_reg_clf = LogisticRegression()print(log_reg_clf) LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True, intercept_scaling=1, max_iter=100, multi_class='warn', n_jobs=None, penalty='l2', random_state=None, solver='warn', tol=0.0001, verbose=0, warm_start=False)
이 알고리즘은 튜닝할 하이퍼파라미터가 더 적습니다!
어떤 하이퍼파라미터는 더 중요합니다.
일부는 성능 향상에 도움이 되지 않습니다:
랜덤 포레스트 분류기에서:
n_jobsrandom_state verbose모든 하이퍼파라미터를 ‘학습’하는 것이 합리적이진 않습니다
중요한 하이퍼파라미터:
n_estimators (값을 크게)max_features (여러 값 시도)max_depth & min_sample_leaf (과적합에 중요)criterion참고: 이는 가이드일 뿐입니다
학습 자료:
Python에서의 하이퍼파라미터 튜닝