Skip to main content

Confrmal Based Impact Analysis.

Project description

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_effect

data = 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:])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

ConformalImpact-0.0.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file ConformalImpact-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for ConformalImpact-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 21219c14df14602c8da2c19c33eeef79770be3d573173ac30bb323eb34705263
MD5 f7a6d2354a7ed6cce5f03f645d5f506e
BLAKE2b-256 9a059c1d22ab89817a45ce0b324945634944ae6b264b8c2774ecf3afb4c1a82c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page