数学建模时间序列分析_时间序列分析建模验证

数学建模时间序列分析

时间序列预测 (Time Series Forecasting)

背景 (Background)

This article is the fourth in the series on the time-series data. We started by discussing various exploratory analyses along with data preparation techniques followed by building a robust model evaluation framework. And finally, in our previous article, we discussed a wide range of classical forecasting techniques that must be explored before moving to machine learning algorithms.

本文是有关时间序列数据的系列文章中的第四篇。 我们首先讨论各种探索性分析以及数据准备技术,然后建立一个强大的模型评估框架。 最后,在我们的前一篇文章中,我们讨论了广泛的经典预测技术,在转向机器学习算法之前必须对其进行探索。

Now, in the current article, we are going to apply all these learnings to a real-life dataset. We will work through a time series forecasting project from end-to-end, from importing the dataset, analyzing and transforming the time series to training the model, and making predictions on new data. The steps of this project that we will work through are as follows:

现在,在当前文章中,我们将所有这些学习应用于实际数据集。 我们将从头到尾完成一个时间序列预测项目,从导入数据集,分析和转换时间序列到训练模型,以及对新数据进行预测。 我们将完成的该项目的步骤如下:

  1. Problem Description

    问题描述
  2. Data Preparation and Analysis

    数据准备与分析
  3. Set up an Evaluation Framework

    建立评估框架
  4. Stationary Check: Augmented Dickey-Fuller test

    固定检查:增强的Dickey-Fuller测试
  5. ARIMA Models

    ARIMA模型
  6. Residual Analysis

    残差分析
  7. Bias corrected Model

    偏差校正模型
  8. Model Validation

    模型验证

问题描述 (Problem Description)

The problem is to predict the number of monthly airline passengers. We will use the Airline Passengers dataset for this exercise. This dataset describes the total number of airline passengers over time. The units are a count of the number of airline passengers in thousands. There are 144 monthly observations from 1949 to 1960. Below is a sample of the first few rows of the dataset.

问题是要预测每月的航空公司乘客数量。 我们将使用航空公司乘客数据集进行此练习。 该数据集描述了一段时间内航空公司乘客的总数。 单位是数千名航空公司乘客的总数。 从1949年到1960年,每月进行144次观测。下面是数据集前几行的样本。

Image for post
Sample dataset
样本数据集

You can download this dataset from here.

您可以从此处下载该数据集。

此项目的Python库 (Python Libraries for this Project)

We need the following libraries to work on this project. These names are self-explanatory but don’t worry if you are not getting any of them. As we go along you will understand the usage of these libraries.

我们需要以下库来进行此项目。 这些名称是不言自明的,但是不用担心这些名称。 随着我们的前进,您将了解这些库的用法。

import numpy 
from pandas import read_csv
from sklearn.metrics import mean_squared_error
from math import sqrt
from math import log
from math import exp
from scipy.stats import boxcox
from pandas import DataFrame
from pandas import Grouper
from pandas import Series
from pandas import concat
from pandas.plotting import lag_plot
from matplotlib import pyplot
from statsmodels.tsa.stattools import adfuller
from statsmodels.tsa.arima_model import ARIMA
from statsmodels.tsa.arima_model import ARIMAResults
from statsmodels.tsa.seasonal import seasonal_decompose
from statsmodels.graphics.tsaplots import plot_acf
from statsmodels.graphics.tsaplots import plot_pacf
from statsmodels.graphics.gofplots import qqplot

数据准备与分析 (Data Preparation and Analysis)

We will use the read_csv() function to load the time series data as a series object, a one-dimensional array with a time label for each row. It is always good to take a peek at the data to confirm that data has been loaded correctly.

我们将使用read_csv()函数将时间序列数据加载为序列对象,即一维数组,每行带有时间标签。 偷看数据以确认已正确加载数据始终是一件好事。

series = read_csv('airline-passengers.csv', header=0, index_col=0, parse_dates=True, squeeze=True)
print(series.head())
Image for post

让我们通过查看汇总统计数据开始数据分析,我们将快速了解数据分布。 (Let’s begin the data analysis by looking into the summary statistics, we will get a quick idea of the data distribution.)

print(series.describe())
Image for post

We can see the number of observations matches our expectations, the mean is about 280 which we can consider our level in this series. Other statistics like standard deviation and percentiles suggest a large spread of the data.

我们可以看到观察次数与我们的期望相符,平均数约为280,我们可以将其视为本系列的水平。 其他统计数据(例如标准差和百分位数)表明数据分布广泛。

下一步,我们将可视化折线图上的值,该工具可以为问题提供很多见解。 (As a next step, we will visualize the values on a line plot, this tool can provide a lot of insights into the problem.)

series.plot()
pyplot.show()
  • 8
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
华为杯数学建模比赛中的数据分析是比赛中的一个重要环节,它涉及到对给定的数据进行处理、分析和建模。在这个环节中,参赛者需要运用数学和统计学的知识,通过对数据的探索和分析,得出相关结论并提出解决问题的方法。 以下是一般性的数据分析步骤,可以作为参考: 1. 数据清洗:对原始数据进行清洗和预处理,包括处理缺失值、异常值、重复值等,确保数据的质量和准确性。 2. 数据可视化:通过绘制图表、图像等方式将数据可视化,以便更好地理解数据的特征和趋势。 3. 数据探索:对数据进行探索性分析,包括计算统计指标(如均值、方差、相关系数等),寻找变量之间的关系和规律。 4. 模型建立:根据问题的要求,选择适当的数学模型(如线性回归、时间序列分析、聚类分析等),并进行模型的建立和参数估计。 5. 模型评估:对建立的模型进行评估,包括模型的精度、拟合度、稳定性等指标的评估,以验证模型的可靠性和适用性。 6. 结果解释:通过对模型结果的解释和推断,得出结论并提出解决问题的方法和建议。 需要注意的是,数据分析的具体方法和步骤会根据具体的比赛题目和数据特点而有所不同。因此,在参加华为杯数学建模比赛时,建议仔细阅读比赛规则和题目要求,并运用适当的数学工具和技巧进行数据分析。祝你在比赛中取得好成绩!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值