-1

I used to Facebook Prophet library, now I have a problem. When I use add_changepoints_to_plot function, I can see red lind and red dots line about change points, but I want to get this values. How to get a values about change points or incline?

I wanna get numerical values of moments or values of time about change points. And I need way to decision whether the trend goes up or down through values.

Daniel V
  • 1,305
  • 7
  • 23
Jay Kim
  • 1
  • 1

2 Answers2

1

Welcome SO. You need to provide some code snippet.

Prophet need a data frame which contains two columns (ds and y). While column ds contains dates, column y contains value of the date. As far as i understand, your data have changepoints and you want to see the values on changepoint dates

I'll leave an example code snippet here assuming you have a df with column "ds" and "y":

estimator = Prophet()
estimator.fit(df)
df.loc[df["ds"].isin(estimator.changepoints)]

estimator.changepoints contains the dates which occur changepoints. If you filter these dates from your dataframe you will get changepoint values.

Iron Hand Odin
  • 410
  • 4
  • 10
0

For example:

mdl = Prophet(yearly_seasonality=True, interval_width=0.95, n_changepoints = 5)
mdl.add_country_holidays(country_name='US')
mdl.fit(df)
mdl.changepoints

Output:

62 2021-07-06

125 2021-09-07

187 2021-11-08

250 2022-01-10

312 2022-03-13 Name: ds, dtype: datetime64[ns]

ifashion1210
  • 21
  • 1
  • 3