Skip to main content

Running estimates of moments

Project description

momentum tests deploy

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.

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.

Project details


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.6.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

momentum-0.2.6-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file momentum-0.2.6.tar.gz.

File metadata

  • Download URL: momentum-0.2.6.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for momentum-0.2.6.tar.gz
Algorithm Hash digest
SHA256 16d343d8ae4b7fa9d5c031158685d5d315ac171f4efde56660fa50d97584ff4b
MD5 ff648ec55b38c41fbc08804558862cdc
BLAKE2b-256 d37d354bff0da22290d2a3f766f8ea0901a9eeccebf0a19cd664599f2f504747

See more details on using hashes here.

File details

Details for the file momentum-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: momentum-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for momentum-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 79c57e8a380b9b0815e61fd88e63828ff5a8d700de19ce686cbee1e1dd27ba7c
MD5 90a5f0398b0a369e80e163f371416acb
BLAKE2b-256 e163f0d706fe375cbd058191a1978d6f51148bdf301cb108314525c835e1d393

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