Skip to main content

Running estimates of moments

Project description

momentum tests deploy

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


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

Uploaded Source

Built Distribution

momentum-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: momentum-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for momentum-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bb92bb5e0b83f41a1e068bf095b8c1fd2297c4f94c89c422972f1a3798e211a7
MD5 a36d077271fd87df568fa066a623e743
BLAKE2b-256 a4f7086b5966306b29b608f337f1c5bc47eddb2268980da181e5f70782c01a81

See more details on using hashes here.

File details

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

File metadata

  • Download URL: momentum-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for momentum-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48a6f94dbab60c8585d0ee4fed60fc9b9b4b770c870a1e7000beacbbee59d5c9
MD5 8afeae004254382b4444e9dc3b4efe6a
BLAKE2b-256 e8e73df6517afcaba177cc3f3fb81d7a7f099210af5e11c2f7608d29281a8baa

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