본문 바로가기
Note/Data Analysis

prophet diagnostics cross_validation

by sooyeoon 2022. 11. 3.

cross_validation

ㆍinitial = 초기 학습 범위
ㆍperiod = 학습 간격 (~마다)
ㆍhorizon = 예측 범위
# ex
from prophet.diagnostics import cross_validation
df_cv = cross_validation(m, initial='730 days', period='180 days', horizon = '365 days')

→ 2년치 데이터 학습, 180일마다 1년치의 값을 예측한다.

 

cutoff

교차 검증 중에 사용할 컷오프 날짜 벡터입니다. 입력하지 않는 경우 (끝-horizon)에서 시작하는 작업은 초기값에 도달할 때까지 간격을 두고 컷오프를 만드는 역방향으로 작업
# Python
cutoffs = pd.to_datetime(['2013-02-15', '2013-08-15', '2014-02-15'])
df_cv2 = cross_validation(m, cutoffs=cutoffs, horizon='365 days')

→ 6월 간격으로 3개의 컷오프 지정

 

performance_metrics

ㆍMSE mean squared errorRMSE root mean squared error
ㆍMAE mean absolute error
ㆍMAPE mean absolute percent error
ㆍMDAPE median absolute percent
ㆍerrorcoverage of the yhat_lower and yhat_upper estimates
# Python
from prophet.diagnostics import performance_metrics
df_p = performance_metrics(df_cv)
df_p.head()

 

참고