先知模型 facebook
Time series prediction is one of the must-know techniques for any data scientist. Questions like predicting the weather, product sales, customer visit in the shopping center, or amount of inventory to maintain, etc - all about time series forecasting, making it a valuable addition to a data scientist’s skillsets.
时间序列预测是任何数据科学家都必须了解的技术之一。 诸如预测天气,产品销售,购物中心的顾客来访或要维护的库存量之类的问题都与时间序列预测有关,这使其成为数据科学家技能的宝贵补充。
In this article, I will introduce how to use Facebook Prophet to predict the crime rate in Chicago. Split into 5 parts:
在本文中,我将介绍如何使用Facebook Prophet预测芝加哥的犯罪率。 分为5部分:
1. Prophet Introduction
1.先知介绍
2. EDA
2. EDA
3. Data processing
3.数据处理
4. Model prediction
4.模型预测
5. Takeaways
5.外卖
Let’s begin the journey.
让我们开始旅程。
1. Prophet Introduction
1.先知介绍
In 2017, Facebook Core Data Science Team open-sourced Prophet. As stated on its Github page, Prophet is:
2017年,Facebook核心数据科学团队开源了Prophet。 如其Github页所述,先知是:
- a procedure for forecasting time series data; 预测时间序列数据的程序;
- based on additive models; 基于加性模型;
- fit non-linear trends with yearly, weekly, and daily seasonality, plus holiday effect. 使非线性趋势与每年,每周和每天的季节性相适应,再加上假期影响。
Prophet uses a decomposable model with three main components, including trend, seasonality, and holidays, as combined below:
先知使用具有三个主要组成部分的可分解模型,包括趋势,季节性和假日,如下所示:
Where:
哪里:
g(t) is the trend function which models non-periodic changes;
g(t)是模拟非周期性变化的趋势函数;
s(t) represents periodic changes (e.g., weekly and yearly seasonality);
s(t)代表周期性变化(例如,每周和每年的季节性变化);
h(t) represents the effects of holidays which occur on potentially irregular schedules;
h(t)表示假期可能在不定期的时间表上发生的影响;
- the error term represents any idiosyncratic changes which are not accommodated by the model. 错误项表示模型不适应的任何特有变化。
So using time as a regressor, Prophet tries to fit linear and non-linear functions of time as components. In effect, Prophet frames the forecasting problem as a curve-fitting exercise, instead of looki