Reputation: 51
I am working with an dataset of crimes in chicago and specially working on a future prediction of the crime rate in chicago (from 2012 till 2016 I have data). I generated a forecast using the prophet package of facebook. It worked very well and all done. Now I would like to train and test my model. Therefore, I split the dataset into 70% train and 30% test. I trained the model and test it and at the end I got a nice plot. I am further interested in the diagnostic part. Prophet provides for that a function called cross_validation()
which I used: df.cv<- cross_validation(m, initial = nrow(trainData), period = 365, horizon = nrow(testData), units = 'days')
. The problems is here, I am geting always this error and trying since yesterday to fix it, without success:
Fehler in generate_cutoffs(df, horizon.dt, initial.dt, period.dt) :
Less data than horizon after initial window. Make horizon or initial shorter.
Does somebody know how to fix this error and provide a list of diagnostics?
My train/test plot looks so:
And my train Dataset can be downloaded here: https://ufile.io/4e38c And my test Dataset here: https://ufile.io/ds65p
I hope somebody could help me! It would be really great and I would really appreciate it. Thanks in advance!
Upvotes: 4
Views: 7828
Reputation: 448
I had similar issue and I managed to fix it by using string arguments such as horizon="365 days"
, instead of int horizon = 365
.
This solution worked on Python version.
Upvotes: 2
Reputation: 1265
Cross-validation will be applied on a sliding window, performing cutoffs based on the settings. Please read the docs here: https://facebook.github.io/prophet/docs/diagnostics.html
The error you get because your sliding window is out of bounds. Try like this:
df.cv<- cross_validation(m, initial = 100, period = 100, horizon = 100, units = 'days')
Upvotes: 4