🎸 기타/πŸŽƒ μ˜μ–΄

[Blog] Time Series Transformation Package : scalecast

isdawell 2023. 1. 27. 14:52
728x90

 

 https://medium.com/towards-data-science/time-series-transformations-and-reverting-made-easy-f4f768c18f63

 

Time Series Transformations (and Reverting) Made Easy

Exploring transformations for time series and how to revert them with scalecast in Python

towardsdatascience.com

 

 

 

 

 

 

πŸ‘€ Summary 


 

β–Έ Stationarity is an important factor in forecasting time series data. It means that its tendency to return to its mean value over time. (평균과 뢄산이 μΌμ •ν•˜κ³ , νŠΉμ •ν•œ μΆ”μ„Έκ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” μ„±μ§ˆ)

 

β–Έ ARIMA, Holt-Winters, Exponential Smoothing and others → do not necessarily require stationary data 

    • Ex. ARIMA λͺ¨λΈμ˜ 경우 차뢄을 톡해 정상성을 λ§Œμ‘±μ‹œν‚΄ 

 

β–Έ However, popular ML model like XGBoost hos no regards for series' stationarity → need to apply transformation 

 

 

 

 

πŸ”Ή scalecast python packages 

 

• 비정상 μ‹œκ³„μ—΄ 데이터λ₯Ό λ³€ν˜•μ‹œν‚€λŠ”λ° ν•„μš”ν•œ 라이브러리 

 

pip install --upgrade scalecast

from scalecast.Forecaster import Forecaster
from scalecast.SeriesTransformer import SeriesTransformer

 

 

• Transformer 적용 

 

#

data = pd.read_csv('AirPassengers.csv')

f = Forecaster(
    current_dates = data['Month'],
    y = data['#Passengers'],
    future_dates = 24,
) 

transformer = SeriesTransformer(f)



# πŸ‘‰ λ‹€μ–‘ν•œ μ’…λ₯˜μ˜ μ°¨λΆ„ 

f = transformer.DiffTransform(12) # 12 periods is one seasonal difference for monthly data
f = transformer.DetrendTransform()

 

 

 

• λ‹€μ–‘ν•œ μ’…λ₯˜μ˜ μ°¨λΆ„ 방법듀을 μ μš©μ‹œν‚¬ 수 있음 :  first differencing, second differencing and beyond, seasonal differencing, linear detrending, polynomial detrending, logarithmic detrending, scaling, boxcox transformations ... 

 

 

https://github.com/mikekeith52/scalecast

 

GitHub - mikekeith52/scalecast: The practitioner's forecasting library

The practitioner's forecasting library. Contribute to mikekeith52/scalecast development by creating an account on GitHub.

github.com

 

 

예츑λͺ¨λΈμ„ λ°”λ‘œ λΆˆλŸ¬μ™€ μ‹€ν–‰μ‹œν‚¬ μˆ˜λ„ 있으며, μ°¨λΆ„ μ΄μ „μ˜ λ°μ΄ν„°λ‘œ 되돌릴 μˆ˜λ„ μžˆλ‹€. λ˜ν•œ Auto-transforming κΈ°λŠ₯을 μ œκ³΅ν•΄, κ°€μž₯ 졜적의 μ„±λŠ₯을 λ³΄μ΄λŠ” λ³€ν˜• 방법을 μΆ”μ²œλ°›μ„ 수 μžˆλŠ” κΈ°λŠ₯ λ˜ν•œ μ‘΄μž¬ν•œλ‹€. 

 

 

from scalecast.util import find_optimal_transformation

 

 

 

 

πŸ“š Vocab 


• revert : μ›λž˜ μƒνƒœλ‘œ λŒμ•„κ°€λ‹€ 

• spurious : κ°€μ§œμ˜, 비논리적인

• deceptively : 기만적으둜

 

 

 

728x90