3

I am using Facebook Prophet to forecast some time series data on monthly base.

ds           y  
2020-02-01  400.0
2020-03-01  450.0
2020-04-01  0.0 
2020-05-01  225.0

I would like to use the cross_validation() function to evaluate my results.

from fbprophet.diagnostics import cross_validation,performance_metrics
cv_results = cross_validation(
   model = m,
   initial = pd.to_timedelta(12,unit="M"), 
   horizon = pd.to_timedelta(12,unit="M"))
df_p = performance_metrics(cv_results)

However I get the following message: ValueError: Units 'M' and 'Y' are no longer supported, as they do not represent unambiguous timedelta values durations.

Does anyone have a workaround? Thanks!

IAmHuman
  • 31
  • 2

1 Answers1

1

I believe units longer than a day ("D") are no longer supported by pandas. This issue arises whenever you use pandas timedelta for those time units.

I'd suggest using days and multiply 30 days times the number of months intended

from fbprophet.diagnostics import cross_validation,performance_metrics

cv_results = cross_validation(
   model = m,
   initial = pd.to_timedelta(30*12,unit="D"), 
   horizon = pd.to_timedelta(30*12,unit="D"))
df_p = performance_metrics(cv_results)```