# momentum ![tests](https://github.com/microprediction/momentum/workflows/tests/badge.svg) ![deploy](https://github.com/microprediction/momentum/workflows/deploy/badge.svg)
A trivial mini-package for computing the running univariate mean, variance, kurtosis and skew
- No dependencies ... not even numpy.
- No classes ... unless you want them.
- State is a dict, for trivial serialization.
- Tested against scipy, creme, statistics
For multivariate covariance updating, maybe see [precise](https://github.com/microprediction/precise).
### Install
pip install momentum
### Usage: running mean, var
from momentum import var_init, var_update
from pprint import pprint
m = var_init()
for x in [5,3,2.4,1.0,5.0]:
m = var_update(m,x)
pprint(m)
### Usage: running mean, var, kurtosis and skew
from momentum import kurtosis_init, kurtosis_update
m = kurtosis_init()
for x in [5,3,2.4,1.0,5.0]:
m = kurtosis_update(m,x)
pprint(m)
File an issue if you need more help using this.
### Usage: running recency-weighted mean, var
from momentum import rvar_init, rvar_update
from pprint import pprint
m = rvar_init(rho=0.01,n=15)
for x in [5,3,2.4,1.0,5.0]:
m = rvar_update(m,x)
pprint(m)
This will switch from running variance to a weighted variance after 15 data points.
Raw data
{
"_id": null,
"home_page": "https://github.com/microprediction/momentum",
"name": "momentum",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "microprediction",
"author_email": "pcotton@intechinvestments.com",
"download_url": "https://files.pythonhosted.org/packages/9d/7c/1f52beeb73b440ecd2cdccf1898e8dbc0e796af158a890e95ddfa585f49f/momentum-0.2.7.tar.gz",
"platform": "",
"description": "# momentum ![tests](https://github.com/microprediction/momentum/workflows/tests/badge.svg) ![deploy](https://github.com/microprediction/momentum/workflows/deploy/badge.svg)\nA trivial mini-package for computing the running univariate mean, variance, kurtosis and skew\n\n- No dependencies ... not even numpy.\n- No classes ... unless you want them.\n- State is a dict, for trivial serialization. \n- Tested against scipy, creme, statistics\n\nFor multivariate covariance updating, maybe see [precise](https://github.com/microprediction/precise). \n\n### Install \n\n pip install momentum\n\n### Usage: running mean, var\n\n from momentum import var_init, var_update\n from pprint import pprint\n \n m = var_init()\n for x in [5,3,2.4,1.0,5.0]:\n m = var_update(m,x)\n pprint(m)\n \n \n\n### Usage: running mean, var, kurtosis and skew \n\n from momentum import kurtosis_init, kurtosis_update\n \n m = kurtosis_init()\n for x in [5,3,2.4,1.0,5.0]:\n m = kurtosis_update(m,x)\n pprint(m)\n \n \nFile an issue if you need more help using this. \n \n \n### Usage: running recency-weighted mean, var\n\n from momentum import rvar_init, rvar_update\n from pprint import pprint\n \n m = rvar_init(rho=0.01,n=15)\n for x in [5,3,2.4,1.0,5.0]:\n m = rvar_update(m,x)\n pprint(m)\n \nThis will switch from running variance to a weighted variance after 15 data points. \n \n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Running estimates of moments",
"version": "0.2.7",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "6696a6b37b15295f2ecb1202012dbd50",
"sha256": "e6a86b8f44ce8df3d71bd41f0be27a1ff6b0493e0cf491c8389ffb1fd5f528b3"
},
"downloads": -1,
"filename": "momentum-0.2.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6696a6b37b15295f2ecb1202012dbd50",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7013,
"upload_time": "2022-03-05T15:30:03",
"upload_time_iso_8601": "2022-03-05T15:30:03.597036Z",
"url": "https://files.pythonhosted.org/packages/53/32/df99de866fe249d36288bd1993866274ee16c889fec100e335ebd3460598/momentum-0.2.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "b6c6bdd8af9da877c2123519e2e7eb02",
"sha256": "fbb3610e3d002d4ec817b9b65117d6314a3d22fe29acb289e12842e5cfe05fa6"
},
"downloads": -1,
"filename": "momentum-0.2.7.tar.gz",
"has_sig": false,
"md5_digest": "b6c6bdd8af9da877c2123519e2e7eb02",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5804,
"upload_time": "2022-03-05T15:30:05",
"upload_time_iso_8601": "2022-03-05T15:30:05.196488Z",
"url": "https://files.pythonhosted.org/packages/9d/7c/1f52beeb73b440ecd2cdccf1898e8dbc0e796af158a890e95ddfa585f49f/momentum-0.2.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-03-05 15:30:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "microprediction",
"github_project": "momentum",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "momentum"
}