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

How to save the results #78

Open justdoit456258 opened 8 months ago

justdoit456258 commented 8 months ago

Hi @WillianFuks

Question one:I want to save daily predictions to calculate daily increments. Please help me how to save the daily results.

Question two:The time for my inputting data is only from June to October, but the plot is complete from June to December. The X-axis automatically fills the time series. The fluctuation of the curve looks unclear. How can I modify the settings of the x-axis and y-axis to look like Figure 2? Picture one:

image

Picture two: image

WillianFuks commented 8 months ago

Hi @justdoit456258 ,

  1. Currently there's no way to save the predictions. Not sure if this would be necessary though. You could use the ci object to take the predictions for each day and work with those (notice that each day predicted follows a Kalman-Filter algorithm that keeps updating a latent space based set of variables so each new prediction is just the continuation of the filtering process going on). Please refer to the official docs for some possibilities on this approach.

  2. The predicted plot doesn't seem to be in accordance to your input data. Something seems to be wrong there but it's hard to tell what happened. Maybe it's the units of the observed that is too big (shouldn't be a problem a prior). Could you share the data you are using (or something equivalent so I can test locally?) Also, could you share the code you are using to implement the fitting process?

justdoit456258 commented 8 months ago

Hi @WillianFuks , Thank you for your reply! The attachment file is my input data.You can use it to test.The predicted time period is 2021-09-01 to 2021-10-06. I look forward to seeing the performance of your model. justdoit_22-23data.csv