학습-검증 분할
이번 연습에서는 candy 생산량 데이터셋을 학습용과 검증용 세트로 나눠 보겠습니다. 영상에서 보셨듯이, 이렇게 나누는 이유는 모델을 다 학습시킨 뒤 적합도의 품질을 평가하기 위해서예요.
candy 생산량 데이터셋은 이미 candy로, 그리고 pyplot은 plt로 불러와 두었습니다.
이 연습은 강의의 일부입니다
Python으로 배우는 ARIMA 모델
연습 안내
datetime인덱스로 슬라이싱하여 시계열을 학습용과 검증용 세트로 나누세요. 학습용은 2006년 말까지, 검증용은 2007년 초부터로 설정하세요.subplots()함수를 사용해pyplot축을 만드세요.- DataFrame의
.plot()메서드를 사용해 학습용과 검증용 세트를 축ax에 그리세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Split the data into a train and test set
candy_train = candy.____
candy_test = candy.____
# Create an axis
fig, ax = ____
# Plot the train and test sets on the axis ax
candy_train.____(ax=____)
candy_test.____(ax=____)
plt.show()