Skip to Content
精通数据科学算法
book

精通数据科学算法

by Posts & Telecom Press, David Natingga
May 2024
Intermediate to advanced
181 pages
3h 9m
Chinese
Packt Publishing
Content preview from 精通数据科学算法

第7章 时间序列分析

时间序列分析是对时间相关数据的分析。给定一段时间内的数据,我们的目的是预测在另一段时期内的数据,通常是预测未来的某时期。例如,时间序列分析被用于预测金融市场、地震和天气。本章主要关注的是预测某些量的数值,例如2030年的人口数量。

基于时间预测的要素如下。

  • 数据的趋势:随着时间的流逝,变量是会上升还是下降呢?例如,人口增长还是收缩?
  • 季节性:数据如何根据时间依赖于某些常规事件?例如,餐厅在周五的销售量是否比周二的更大?

时间序列分析的这两个要素提供了一个强大的方法来进行时间相关的预测。在本章中,您将学习以下内容:

  • 如何使用回归来分析数据趋势,例如商业利润;
  • 在电子商店的销售案例中,如何观察和分析呈季节性变动的数据的循环模式;
  • 以电子商店的销售为例,将趋势分析和季节性分析结合起来预测相关数据;
  • 使用R构建商业利润和电子商店销售案例的时间依赖模型。

已知前几年的利润,现在要预测一家企业在2018年所获利润,数据如表7-1所示。

表7-1

利润(美元)

2011

40k

2012

43k

2013

45k

2014

50k

2015

54k

2016

57k

2017

59k

2018

?

[分析]

在这个例子中,利润在持续增加,我们可以把利润表示为依赖于以年计数的时间变量的增长函数。后面几年的利润差值是:3k、2k、5k、4k、3k和2k美元。这些差值似乎没有受到时间的影响,它们之间的变化相对较小。因此,可以尝试通过线性回归来预测未来几年的利润。在线性方程中用年数y(year)来表示利润p(profit),该等式可称为趋势线: ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

数据科学原理

数据科学原理

Posts & Telecom Press, Sinan Ozdemir
PyTorch深度学习

PyTorch深度学习

Posts & Telecom Press, Vishnu Subramanian
程序员学数据结构

程序员学数据结构

Posts & Telecom Press, William Smith
可编程网络自动化

可编程网络自动化

Jason Edelman, Scott S. Lowe, Matt Oswalt

Publisher Resources

ISBN: 9781836204596