로컬 검증

Python으로 Kaggle 대회 공략하기

Yauhen Babakhin

Kaggle Grandmaster

동기 부여

공개/비공개 리더보드 과적합 예시

Python으로 Kaggle 대회 공략하기

홀드아웃 세트

홀드아웃 세트 도식

Python으로 Kaggle 대회 공략하기

홀드아웃 세트

홀드아웃 세트 도식

Python으로 Kaggle 대회 공략하기

홀드아웃 세트

홀드아웃 세트 도식

Python으로 Kaggle 대회 공략하기

K-겹 교차 검증

 

학습 데이터를 4개 폴드로 분할

Python으로 Kaggle 대회 공략하기

K-겹 교차 검증

 

K-겹 교차 검증 도식

Python으로 Kaggle 대회 공략하기

K-겹 교차 검증

# Import KFold
from sklearn.model_selection import KFold
# Create a KFold object
kf = KFold(n_splits=5, shuffle=True, random_state=123)
# Loop through each cross-validation split
for train_index, test_index in kf.split(train):

# Get training and testing data for the corresponding split cv_train, cv_test = train.iloc[train_index], train.iloc[test_index]
Python으로 Kaggle 대회 공략하기

계층화 K-겹

  계층화 K-겹 교차 검증 도식

Python으로 Kaggle 대회 공략하기

계층화 K-겹

# Import StratifiedKFold
from sklearn.model_selection import StratifiedKFold

# Create a StratifiedKFold object str_kf = StratifiedKFold(n_splits=5, shuffle=True, random_state=123)
# Loop through each cross-validation split for train_index, test_index in str_kf.split(train, train['target']): cv_train, cv_test = train.iloc[train_index], train.iloc[test_index]
Python으로 Kaggle 대회 공략하기

연습해 봅시다!

Python으로 Kaggle 대회 공략하기

Preparing Video For Download...