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?

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

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

## 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

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

##### Ecommerce product reviews - Pairwise ranking and sentiment analysis
This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.

##### Zillow’s Home Value Prediction (Zestimate)
Data Science Project in R -Build a machine learning algorithm to predict the future sale prices of homes.

##### Credit Card Fraud Detection as a Classification Problem
In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

##### Loan Eligibility Prediction using Gradient Boosting Classifier
This data science in python project predicts if a loan should be given to an applicant or not. We predict if the customer is eligible for loan based on several factors like credit score and past history.

##### Data Science Project-TalkingData AdTracking Fraud Detection
Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

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

##### 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.

##### Human Activity Recognition Using Multiclass Classification in Python
In this human activity recognition project, we use multiclass classification machine learning techniques to analyse fitness dataset from a smartphone tracker.

##### Customer Market Basket Analysis using Apriori and Fpgrowth algorithms
In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.