Validating tz from dtype fails during model.predict(df) on prophet model

28 Views Asked by At

I have a prophet model developed in databricks runtime and i am sharing here how i have registered the model, loaded and used the same for forecasting:

 mlflow.register_model(model_uri, model_name)
 model = mlflow.prophet.load_model(model_uri)
 future_dataframe = model.make_future_dataframe(period)
 forecast = model.predict(future_dataframe)`

Here, period is a user input representing forecast_period.

This is giving me the following warning:

/databricks/python/lib/python3.10/site-packages/prophet/serialize.py:160: FutureWarning: The behavior of Timestamp.utcfromtimestamp is deprecated, in a future version will return a timezone-aware Timestamp with UTC timezone. To keep the old behavior, use Timestamp.utcfromtimestamp(ts).tz_localize(None). To get the future behavior, use Timestamp.fromtimestamp(ts, 'UTC')
setattr(model, attribute, pd.Timestamp.utcfromtimestamp(model_dict[attribute]).tz_localize(None))

In the databricks env i am able to view the forecast df along with the warning. However, upon deployment using kubernetes, the pod container is failing to run because of this issue. The error i am getting within the container is this:

File "/usr/local/lib/python3.9/site-packages/pandas/core/arrays/datetimes.py", line 2615, in _validate_tz_from_dtype raise ValueError(ValueError: cannot supply both a tz and a timezone-naive dtype (i.e. datetime64[ns]): Error while type casting for column 'ds'

Any insight on what is happening here is appreciated. What i am looking to understand is that the column 'ds' is of type datetime64[ns] i.e. with a naive-timezone which matches the type of ds column generated in future_dataframe used for prediction above. Then where is the dtype coming from with a timezone giving rise to this conflict?

0

There are 0 best solutions below