Time Series Flashcards
Time Series - fundamentals
- trends: a gradual change in average level as time moves on: increasing, decreasing, or neither.
- seasonality: a certain behavior happens every season. For example, tax season, baseball, etc.
How to find trend in time series?
Moving average is one way to detrend a time series data. Moving average is to put a window in a time series data, calculate the average in that window, move one step forward, then calculate the average in that window. For example, first window is 10-20, second window is 11-21, etc. You can use this method to find the trend of a time series - the tighter the window, you more noise you’ll capture. The bigger the window, the less fluctuation you’ll capture - good practice to be in the middle.
Don’t mix this up with supervised learning in terms of signal and noise, we mainly want to capture the trend for time series.
How to capture seasonality in time series?
To deseasonalize a time series, we can breakdown the time series into weeks or months, then train our data based on those features. Do one hot encoding based on months, remove the year, so we can see what’s going on in Jan, Feb, and so on.
Base on the pattern that you observe, you can breakdown time series to weeks, quarters, etc.
Trend-Seasonal-Residual Decomposition
40:00
It expresses a time series as = trend + seasonality + residuals.
This method is built into python
var = sm.tsa.seasonal_decompose(google_rends[‘python’])