Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tblume1992/ConformalImpact
Causal Impact but with MFLES and conformal prediction intervals
https://github.com/tblume1992/ConformalImpact
Last synced: 3 months ago
JSON representation
Causal Impact but with MFLES and conformal prediction intervals
- Host: GitHub
- URL: https://github.com/tblume1992/ConformalImpact
- Owner: tblume1992
- License: mit
- Created: 2024-02-10T17:36:45.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-10T18:03:29.000Z (9 months ago)
- Last Synced: 2024-07-07T05:01:49.238Z (4 months ago)
- Language: Python
- Size: 273 KB
- Stars: 34
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-conformal-prediction - Conformal Impact
README
# Conformal Impact
Take Causal Impact and replace the Bayesian Structural Time Series Model with MFLES and the Basyesian posterior with Conformal Prediction Intervals.## Quick Examnple an comparison to Causal Impact
```
intervention_effect = 400
np.random.seed(42)
series = np.random.random((130, 1)) * 400
x_series = series * .4 + np.random.random((130, 1)) * 50 + 1000
trend = (np.arange(1, 131)).reshape((-1, 1))
series += 10 * trend
series[-30:] = series[-30:] + intervention_effectdata = pd.DataFrame(np.column_stack([series, x_series]), columns=['y', 'x1'])
import matplotlib.pyplot as plt
plt.plot(series)
plt.plot(x_series)
plt.show()from ConformalImpact.Model import CI
conformal_impact = CI(opt_size=20,
opt_steps=10,
opt_step_size=3)
impact_df = conformal_impact.fit(data,
n_windows=30,
intervention_index=100,
seasonal_period=None)conformal_impact.summary()
conformal_impact.plot()from causalimpact import CausalImpact
impact = CausalImpact(data, [0, 99], [100, 130])
impact.run()
impact.plot()
print(impact.summary())
output = impact.inferences
np.mean(output['point_effect'].values[-30:])
```