Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
孊ぶ Convert Non-Stationary Data to Stationary | Non-Stationary Models
Time Series Analysis

Convert Non-Stationary Data to Stationary

メニュヌを衚瀺するにはスワむプしおください

So, let's move on to the stage of processing non-stationary data. You have already seen predictive models that you can use to work with stationary data, but since most data is non-stationary, there are ways to convert it.

There are many types of transformations, such as difference, logarithmic transformation, proportional change, etc. But the main idea of mathematical transformations is to apply some function for each value of the time series to remove the time dependence (this includes trends and seasonality).

We will start with the differencing used in the ARIMA model. The principle is simple - the past value is subtracted from the current one:

This allows you to stabilize the value of the time series, making it more constant. Let's implement the difference transformation using Python:

dataset["diff_1"] = dataset["Open"].diff(periods=1).dropna()

Let's move on to the logarithmic transformation. If the difference allows us to equalize the mean, then the logarithmic transformation stabilizes the time series variance. The only limitation is that the logarithmic transformation can only work with positive values.

Below is the code for logarithmic transformation (log transformation):

import numpy as np

dataset["log"] = np.log(dataset["Open"])
タスク

スワむプしおコヌディングを開始

Implement a difference transformation on the AirPassengers.csv dataset and output the average before and after for the #Passengers column.

  1. Read the AirPassengers.csv file.
  2. Drop the "Month" column out of the df DataFrame.
  3. Calculate the mean value of the "#Passengers" column before changes.
  4. Calculate the differences of each value of the column"#Passengers" compared with the previous (periods = 1`), drop NA values, and calculate the mean for the updated column.

解答

Switch to desktop実践的な緎習のためにデスクトップに切り替える䞋蚘のオプションのいずれかを利甚しお、珟圚の堎所から続行する
すべお明確でしたか

どのように改善できたすか

フィヌドバックありがずうございたす

セクション 5. 章 2
single

single

AIに質問する

expand

AIに質問する

ChatGPT

䜕でも質問するか、提案された質問の1぀を詊しおチャットを始めおください

some-alt