tfcausalimpact
tfcausalimpact copied to clipboard
Running the causal impact algorithm leaks memory.
Running the causal impact algorithm appears to leak memory.
Reproduction code:
import gc
import pandas as pd
from causalimpact import CausalImpact
data = pd.read_csv('https://raw.githubusercontent.com/WillianFuks/tfcausalimpact/master/tests/fixtures/arma_data.csv')[['y', 'X']]
data.iloc[70:, 0] += 5
pre_period = [0, 69]
post_period = [70, 99]
def run_causal_impact():
ci = CausalImpact(data, pre_period, post_period)
print(ci.summary())
print(ci.summary(output='report'))
for _ in range(10):
run_causal_impact()
gc.collect()
Dependencies:
[tool.poetry.dependencies]
python = "=3.11.4"
pandas = "=2.2"
tensorflow = "=2.16.1"
tfcausalimpact = "=0.0.15"
pyarrow = "=15.0.2"
I run the program and watch the activity monitor, and each iteration leaks ~80mb or so.