m = Prophet()
m.fit(df)
The error below was encountered:
Unrecognized token 'Initial': was expecting 'null', 'true', 'false' or NaN
at [Source: Initial log joint probability = -13.932; line: 1, column: 8]
The above error keeps on coming up. Tried downgrading numpy
, reinstalling pystan
and fbprophet
but still issue remains unresolved.
I ran into this same exact issue/error trying to use
prophet
on an AWS EMR Spark cluster (using a jupyter notebook interface). After much trouble shooting, we realized this is because Spark is expecting back a particular data format—I believe a json with particular fields—butprophet
returns apandas
dataframe.I fixed this issue by writing a user-defined function (udf) in pyspark that allows me to use prophet on a Spark data frame and specify what data will be returned from this Spark function.
I based my own solution on the
pandas_udf
functions forprophet
on Spark in this example and this example.Below is a generalized version of the function I wrote. For clarity, I was trying to fit a timeseries model on the data I had in order to detect outliers, hence why I fit and then predict on the same data. You'll also need to make sure
pyarrow
is installed to handle thepandas_udf
properly in Spark:Then to run the function on your data simply do the following: