Running estimates of moments
Project description
momentum
A mini-package for computing the running 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
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 forgettingvar_init, forgettingvar_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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
momentum-0.2.1.tar.gz
(5.6 kB
view details)
Built Distribution
File details
Details for the file momentum-0.2.1.tar.gz
.
File metadata
- Download URL: momentum-0.2.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 116a44f151c4683b91cd30a2f668eb4b8a6701cc194629a7a470c529086ca63a |
|
MD5 | e183634fdb36b032a3c794815c6412b8 |
|
BLAKE2b-256 | 4a26935e6222cd44c629ca3c8a2dce3a43d907d7c78aca7ba17e5cb7957edbea |
File details
Details for the file momentum-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: momentum-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec6cdd2bf21aa877dc6dcaa19fa83d9001382292e66bc8966e02dd0916237b1c |
|
MD5 | 8ae3036f0f1df293ddbf4648c1cfd50a |
|
BLAKE2b-256 | 90392ce4da4b7a3bd5fa4d0f2274334e8f2d2b62c73ec5c4a48aafa1a7377931 |