What is seasonal ARIMA model How to use it?
MACHINE LEARNING RECIPES DATA CLEANING PYTHON DATA MUNGING PANDAS CHEATSHEET     ALL TAGS

What is seasonal ARIMA model How to use it?

What is seasonal ARIMA model How to use it?

This recipe explains what is seasonal ARIMA model is and helps you use it

0

Recipe Objective

A seasonal ARIMA model is formed by including additional seasonal terms in the ARIMA models. The additional seasonal terms are simply multiplied by the non-seasonal terms.

So this recipe is a short example on What is seasonal ARIMA model and how to use it. Let's get started.

Step 1 - Import the library

import numpy as np import pandas as pd from statsmodels.tsa.seasonal import seasonal_decompose import matplotlib.pyplot as plt

Let's pause and look at these imports. Numpy and pandas are general ones. Here, seasonal_decompose will help us in understanding the seasonilty of data.

Step 2 - Setup the Data

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

Here, we have used one time series data from github. Also, we have set our index to date.

Now our dataset is ready.

Step 3 - Plotting the pattern

decomposition = seasonal_decompose(df.value, freq=12) fig = plt.figure() fig = decomposition.plot() fig.set_size_inches(20, 10)

Here, we have broken our datset using seasonal_decompose into trend, residual and seasonal. Residual is the stationary pattern and will almost remain constant. Seasonal is what our seasonal pattern will be. Trend is just our upward or downward movement with time.

Step 4 - Creating Seasonal Dataframe

trend = decomposition.trend seasonal = decomposition.seasonal residual = decomposition.resid print(seasonal)

Apart from visualizing our pattern, we have produced various dataframes based on their patter. Finally, we have printed down our seasonal dataframe.

Step 5 - Lets look at our dataset now

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

Srcoll down the ipython file to visualize the results.

Seasonal, Residual and Trend is visible. Also, we have produced our seasonal dataset in one separte dataframe for further analysis if needed.

Relevant Projects

Music Recommendation System Project using Python and R
Machine Learning Project - Work with KKBOX's Music Recommendation System dataset to build the best music recommendation engine.

Solving Multiple Classification use cases Using H2O
In this project, we are going to talk about H2O and functionality in terms of building Machine Learning models.

Data Science Project on Wine Quality Prediction in R
In this R data science project, we will explore wine dataset to assess red wine quality. The objective of this data science project is to explore which chemical properties will influence the quality of red wines.

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

Natural language processing Chatbot application using NLTK for text classification
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.

Time Series Forecasting with LSTM Neural Network Python
Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.

Mercari Price Suggestion Challenge Data Science Project
Data Science Project in Python- Build a machine learning algorithm that automatically suggests the right product prices.

German Credit Dataset Analysis to Classify Loan Applications
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.

Predict Macro Economic Trends using Kaggle Financial Dataset
In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.

Data Science Project in Python on BigMart Sales Prediction
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.