WillianFuks / tfcausalimpact

Python Causal Impact Implementation Based on Google's R Package. Built using TensorFlow Probability.
Apache License 2.0
593 stars 70 forks source link

Warnings: deprecated tensorflow features #84

Closed TravelsandBooks closed 5 months ago

TravelsandBooks commented 5 months ago

Hi,

I've just started using this library in a project and I'm getting these warnings:

When importing the library:

WARNING:tensorflow:From C:\Users\<>\py39\lib\site-packages\keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

WARNING:tensorflow:From C:\Users\<>\py39\lib\site-packages\tensorflow_probability\python\internal\backend\numpy\_utils.py:48: The name tf.logging.TaskLevelStatusMessage is deprecated. Please use tf.compat.v1.logging.TaskLevelStatusMessage instead.

WARNING:tensorflow:From C:\Users\<>\py39\lib\site-packages\tensorflow_probability\python\internal\backend\numpy\_utils.py:48: The name tf.control_flow_v2_enabled is deprecated. Please use tf.compat.v1.control_flow_v2_enabled instead.

When I instantiate a CI instance:

WARNING:tensorflow:From C:\Users\jharris\py39\lib\site-packages\tensorflow\python\autograph\impl\api.py:459: StructuralTimeSeries.joint_log_prob (from tensorflow_probability.python.sts.structural_time_series) is deprecated and will be removed after 2022-03-01.
Instructions for updating:
Please use `StructuralTimeSeries.joint_distribution(observed_time_series).log_prob`

WARNING:tensorflow:From C:\Users\jharris\py39\lib\site-packages\tensorflow\python\autograph\impl\api.py:459: StructuralTimeSeries.joint_log_prob (from tensorflow_probability.python.sts.structural_time_series) is deprecated and will be removed after 2022-03-01.
Instructions for updating:
Please use `StructuralTimeSeries.joint_distribution(observed_time_series).log_prob`

WARNING:tensorflow:From C:\Users\jharris\py39\lib\site-packages\causalimpact\model.py:408: calling one_step_predictive (from tensorflow_probability.python.sts.forecast) with timesteps_are_event_shape=True is deprecated and will be removed after 2021-12-31.
Instructions for updating:
`Predictive distributions returned by`tfp.sts.one_step_predictive` will soon compute per-timestep probabilities (treating timesteps as part of the batch shape) instead of a single probability for an entire series (the current approach, in which timesteps are treated as event shape). Please update your code to pass `timesteps_are_event_shape=False` (this will soon be the default) and to explicitly sum over the per-timestep log probabilities if this is required.

WARNING:tensorflow:From C:\Users\jharris\py39\lib\site-packages\causalimpact\model.py:408: calling one_step_predictive (from tensorflow_probability.python.sts.forecast) with timesteps_are_event_shape=True is deprecated and will be removed after 2021-12-31.
Instructions for updating:
`Predictive distributions returned by`tfp.sts.one_step_predictive` will soon compute per-timestep probabilities (treating timesteps as part of the batch shape) instead of a single probability for an entire series (the current approach, in which timesteps are treated as event shape). Please update your code to pass `timesteps_are_event_shape=False` (this will soon be the default) and to explicitly sum over the per-timestep log probabilities if this is required.

I still get output but I think these will need to be updated?

WillianFuks commented 5 months ago

Hi @TravelsandBooks ,

Those warnings are indeed annoying but unfortunately everything that I've tried to remove those failed. If someone figures it out we can implement how it's done but so far nothing worked.

For now you can safely ignore them, they are part tensorflow itself.