Prophet models

Prophet models


So every time we think of implementing Time Series Modelling, The first few libraries that come to our mind are — Either Regression, ARIMA or Prophet. But do we know what is happening in the background of these algorithms and how can we further tune them to make it work for out time-series dataset 

Prophet Forecasting Model — It is an Additive Regressive Model

Equation of the model is —

Prophet Forecasting Model Equation

Let’s understand these components in little depth —

In this post, I Will focus on Tuning of Trend factor. In my next post, I will share how to tune?seasonality?and other?components?of the prophet.

g(t) — Trend Factor — It implements two possibles trend models

Trend factor can be adjusted using these models

a)?Logistic growth model?—?It handles non-linear growth with saturation?( you might be wondering what does it mean now? uh .. confused ??)?Let’s understand —

Non-linear growth with saturation — The initial stage of growth is approximately exponential (geometric), as saturation begins, the growth slows to linear (arithmetic) and at maturity, growth stops.

Logistic growth with saturation (taken from solla price 1963)
Logistic Growth model

x0 — X-value of sigmoid’s point

L — Curve’s Maximum value

k — Logistic growth rate or steepness of the curve

m = Prophet(growth='logistic')
m.fit(df)

b) Piecewise Linear Model —?It is a simple modification of linear model, yet very useful. Different ranges of ??, different linear relationships occur ? A single linear model may not provide an adequate explanation or description ? Breakpoints are the value of ?? where the slope changes ? The value of breakpoints may or may not known before the analysis, when unknown it has to be estimated

By Default Prophet uses Linear model for its growth. — Constant rate of growth — It is best suitable for without saturation growth.

Piece-wise linear model
Piecewise linear model

?? be the value of the breakpoint

We can tune these parameters (trend components) in out prophet model by setting the breakpoints (also known as changepoints) and the total CAP i.e market size or capacity value — It must be specified for every row in a data frame and it doesn't have to be constant. If market size is growing then CAP can be an increasing sequence.

# Python
future = m.make_future_dataframe(periods=1826)
future['cap'] = 8.5
fcst = m.predict(future)
fig = m.plot(fcst)


Like CAP we have saturating minimal values also (known as the floor).

# Python
df['y'] = 10 - df['y']
df['cap'] = 6
df['floor'] = 1.5
future['cap'] = 6
future['floor'] = 1.5
m = Prophet(growth='logistic')
m.fit(df)
fcst = m.predict(future)
fig = m.plot(fcst)

The Library can itself choose the optimal points of trend changes by fitting the historical data.

If you want to tune them manually — you can refer?here?—

m = Prophet(changepoint_prior_scale=0.08)

Python code — By default, this parameter (changepoint_prior_scale)is set to 0.05. Increasing it will make the trend?more?flexible.

m = Prophet(changepoint_prior_scale=0.5)
forecast = m.fit(df).predict(future)
fig = m.plot(forecast)

you can manually specify the locations of potential changepoints with the?changepoints?argument

# Python
m = Prophet(changepoints=['2014-01-01'])
forecast = m.fit(df).predict(future)
fig = m.plot(forecast)

you can also set — changepoint_range parameter. By default, Prophet specifies 25 potential changepoints which are uniformly placed in the first 80% of the time series

# Python
from fbprophet.plot import add_changepoints_to_plot
fig = m.plot(forecast)
a = add_changepoints_to_plot(fig.gca(), m, forecast)

Changepoints in Red

You can change this parameter by —

m = Prophet(changepoint_range=0.9)

(based on the breakpoints you have in your data)

So If you see your trend is going upward but your actual dataset points are going downward — then you can tune these parameters to make your trend more flexible ( but do keep in mind not to overfit your data(I will share how to?cross-validate your data?in my upcoming post)).

For example — You can plot the components of the prophet equation using —

m.plot_components(forecast).

So you can tune your above parameters by looking at the trend line (blue solid line — whether is is aligning with you final output or not). If your actual point’s trend is decreasing whereas your forecasted trends seems to be increasing then you definitely need to improvize on your trend component using above discussed parameters.

For seasonality and other components please look at?part2.

Link to my GitHub repository —?https://github.com/DeeptiAgl?tab=repositories

Please do share your feedback and any questions if you have. I will try to answer them to the best of my knowledge.—        

要查看或添加评论,请登录

Darshika Srivastava的更多文章

  • LGD Model

    LGD Model

    Loss Given Default (LGD) models play a crucial role in credit risk measurement. These models estimate the potential…

  • CCAR ROLE

    CCAR ROLE

    What is the Opportunity? The CCAR and Capital Adequacy role will be responsible for supporting the company’s capital…

  • End User

    End User

    What Is End User? In product development, an end user (sometimes end-user)[a] is a person who ultimately uses or is…

  • METADATA

    METADATA

    WHAT IS METADATA? Often referred to as data that describes other data, metadata is structured reference data that helps…

  • SSL

    SSL

    What is SSL? SSL, or Secure Sockets Layer, is an encryption-based Internet security protocol. It was first developed by…

  • BLOATWARE

    BLOATWARE

    What is bloatware? How to identify and remove it Unwanted pre-installed software -- also known as bloatware -- has long…

  • Data Democratization

    Data Democratization

    What is Data Democratization? Unlocking the Power of Data Cultures For Businesses Data is a vital asset in today's…

  • Rooting

    Rooting

    What is Rooting? Rooting is the process by which users of Android devices can attain privileged control (known as root…

  • Data Strategy

    Data Strategy

    What is a Data Strategy? A data strategy is a long-term plan that defines the technology, processes, people, and rules…

  • Product

    Product

    What is the Definition of Product? Ask a few people that question, and their specific answers will vary, but they’ll…

社区洞察

其他会员也浏览了