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

Uploaded Source

Built Distribution

momentum-0.1.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: momentum-0.1.3.tar.gz
  • Upload date:
  • Size: 5.5 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

Hashes for momentum-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f63fd8c35e923ee4d853594e3d9c15893716450e601ad1a7a576635b43a03f36
MD5 5fcb8f6a067a2bb1ea6d4c8bd751f6d7
BLAKE2b-256 21912817b2143ac5504e1dbcdafa72547d3c54ff1919e1d714d00f906b5f5aa8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: momentum-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.6 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

Hashes for momentum-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2afedaee1d883a194452befa414a208fe1a7c470ddc70472f57e51e0aa9a97a6
MD5 ad3d8250507d415ff6579fae5f9d8cbc
BLAKE2b-256 742b44172fb63bb273096ab4f8c3746a389829a53223a556c95dcde3a42e2d46

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