Time series forecasting in time series analysis is a method used to predict future values by applying characteristics of historical data points. It is a type of predictive analytics used to estimate values at a future point in time.

## Algorithms for forecasting

Time series forecasting models are largely broken down into two methods

### Statistical methods in forecasting

Statistical methods involve using classical statistical algorithms to predict future values. Examples include:

**Moving average:**calculating the average over a subset of data in succession. This is useful to smooth out noise in the data and can be effective for short-term predictions.**Exponential smoothing:**exponential smoothing extends simple moving averages by assigning exponentially lower weights to older data points to give more importance to recent data. This method helps to account for recent trends or seasonality in the data.**Autoregressive integrated moving average (ARIMA):**ARIMA model is one of most popular and effective algorithms used for time series forecasting. It creates a linear relationship with lagging values by taking the difference between successive values as well as moving averages.

## Machine learning methods in forecasting

Statistical models are limited in that it assumes the data follows a statistical distribution. If the data does not follow such distributions, then machine learning models may be more effective. Examples include:

**Support vector machines (SVM):**While mostly used in classification tasks, SVMs can also be used in forecasting. SVMs aim to find one or more hyperplanes that maximize the distance between data points in both classes**Random forest:**Random forests are a type of tree-based algorithm that picks random data points from the data set and iteratively builds a decision tree. It can capture non-linear relationships that traditional statistical models may not extract**Long short-term memory networks (LSTM):**LSTMs are a type of recurrent neural network model that works well with processing sequential data. LSTMs are great for learning long-term dependencies in the data

Depending on the data, these two approaches can be combined. In general, statistical models are quicker and easier to implement. However, if you need greater accuracy or if the data does not fit under a statistical distribution, machine learning approaches can perform better.

## Applications of forecasting

Time series forecasting is widely used in various industries:

**E-commerce:**time series data is often trained to predict future demands including sales, inventory, staffing and so on**Financial:**financial data can involve price prediction or trade volume, whether it is for stocks, crypto, or other commodities**Software infrastructure:**various software infrastructure metrics such as CPU usage, memory spikes or storage, are often forecasted to ensure that the underlying infrastructure can scale for high load**Weather**: Will it be sunny this weekend? Weather forecasts are the quintessential forecast