MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# Explain ARIMA model for time series forecasting?

# Explain ARIMA model for time series forecasting?

This recipe explains ARIMA model for time series forecasting

The Autoregressive Integrated Moving Average (ARIMA) method models the next step in the sequence as a linear function of the differenced observations and residual errors at prior time steps. It combines both Autoregression (AR) and Moving Average (MA) models as well as a differencing pre-processing step of the sequence to make the sequence stationary, called integration (I). The method is suitable for univariate time series with trend and without seasonal components.

So this recipe is a short example on what is ARIMA modelling of time series forecasting. Let's get started.

```
import numpy as np
import pandas as pd
from statsmodels.tsa.arima_model import ARIMA
```

Let's pause and look at these imports. Numpy and pandas are general ones. Here statsmodels.tsa.arima_model is used to import ARIMA library for building of model.

```
df = pd.read_csv('https://raw.githubusercontent.com/selva86/datasets/master/a10.csv', parse_dates=['date'])
df.head()
```

Here, we have used one time series data from github.

Now our dataset is ready.

```
train_data = df[1:len(df)-12]
test_data = df[len(df)-12:]
```

Here we have simply split data into size of 12 and rest elements

```
model = ARIMA(train_data.value, order=(1, 1, 1))
model_fitted = model.fit()
```

The notation for the model involves specifying the order for the AR(p), I(d), and MA(q) models as parameters to an ARIMA function. Here all the parameters are set to be 1.

```
print('coefficients',model_fitted.params)
predictions = model_fitted.predict(start=len(train_data), end=len(train_data) + len(test_data)-1)
print(predictions)
```

Here, we have printed the coeffiecient of model and the predicted values.

Once we run the above code snippet, we will see:

Scroll down the ipython file to visualize the output.

In this data science project, you will work with German credit dataset using classification techniques like Decision Tree, Neural Networks etc to classify loan applications using R.

In this project, we are going to work on Deep Learning using H2O to predict Census income.

In this machine learning churn project, we implement a churn prediction model in python using ensemble techniques.

In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

In this NLP AI application, we build the core conversational engine for a chatbot. We use the popular NLTK text classification library to achieve this.

In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.

Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

In this machine learning resume parser example we use the popular Spacy NLP python library for OCR and text classification.

In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.