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 : ๊ธฐ๋ง์ ์ผ๋ก
'๐ธ ๊ธฐํ > ๐ ์์ด' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Daily English] Nostalgic cartoon characters fuel retailers in recession (0) | 2023.02.10 |
---|---|
[Daily English] As AI war rages, Korea seeks a place among giants (0) | 2023.02.09 |
[Blog] DeepAR: Mastering Time-Series Forecasting with Deep Learning (0) | 2023.02.07 |
[Blog] ChatGPT ์ ๋ฐ์ดํฐ์ฌ์ด์ธ์ค (0) | 2023.01.26 |
[2023] ์์ด ๊ณต๋ถ ๊ณํ (0) | 2023.01.25 |
๋๊ธ