# 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:])
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tblume1992/ConformalImpact",
"name": "ConformalImpact",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "forecasting,time series,seasonality,trend",
"author": "Tyler Blume",
"author_email": "",
"download_url": "",
"platform": null,
"description": "# Conformal Impact\nTake Causal Impact and replace the Bayesian Structural Time Series Model with MFLES and the Basyesian posterior with Conformal Prediction Intervals.\n\n## Quick Examnple an comparison to Causal Impact\n```\nintervention_effect = 400\nnp.random.seed(42)\nseries = np.random.random((130, 1)) * 400\nx_series = series * .4 + np.random.random((130, 1)) * 50 + 1000\ntrend = (np.arange(1, 131)).reshape((-1, 1))\nseries += 10 * trend\nseries[-30:] = series[-30:] + intervention_effect\n\ndata = pd.DataFrame(np.column_stack([series, x_series]), columns=['y', 'x1'])\n\nimport matplotlib.pyplot as plt\n\nplt.plot(series)\nplt.plot(x_series)\nplt.show()\n\n\nfrom ConformalImpact.Model import CI\n\n\nconformal_impact = CI(opt_size=20,\n opt_steps=10,\n opt_step_size=3)\nimpact_df = conformal_impact.fit(data,\n n_windows=30,\n intervention_index=100,\n seasonal_period=None)\n\nconformal_impact.summary()\nconformal_impact.plot()\n\n\n\n\n\nfrom causalimpact import CausalImpact\n\nimpact = CausalImpact(data, [0, 99], [100, 130])\nimpact.run()\nimpact.plot()\nprint(impact.summary())\noutput = impact.inferences\nnp.mean(output['point_effect'].values[-30:])\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Confrmal Based Impact Analysis.",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/tblume1992/ConformalImpact"
},
"split_keywords": [
"forecasting",
"time series",
"seasonality",
"trend"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9a059c1d22ab89817a45ce0b324945634944ae6b264b8c2774ecf3afb4c1a82c",
"md5": "f7a6d2354a7ed6cce5f03f645d5f506e",
"sha256": "21219c14df14602c8da2c19c33eeef79770be3d573173ac30bb323eb34705263"
},
"downloads": -1,
"filename": "ConformalImpact-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f7a6d2354a7ed6cce5f03f645d5f506e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4673,
"upload_time": "2024-02-10T17:55:46",
"upload_time_iso_8601": "2024-02-10T17:55:46.474809Z",
"url": "https://files.pythonhosted.org/packages/9a/05/9c1d22ab89817a45ce0b324945634944ae6b264b8c2774ecf3afb4c1a82c/ConformalImpact-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-10 17:55:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tblume1992",
"github_project": "ConformalImpact",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "conformalimpact"
}