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

Uploaded Source

Built Distribution

momentum-0.2.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: momentum-0.2.2.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for momentum-0.2.2.tar.gz
Algorithm Hash digest
SHA256 210237672332b315d7d4fa539a265752d00e7b37ff5dbd800e78a1a9c61da11c
MD5 21c05552b3876ae70e6717b96a113be8
BLAKE2b-256 13bcc42c30758bf29b8b14fe037027cd30c2bc205e19b867660fcd8185499814

See more details on using hashes here.

File details

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

File metadata

  • Download URL: momentum-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for momentum-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11afa0dbade330b498e1d9d2b7206aa5789fbbe80ca14a33bd92f594f93dab00
MD5 94b2cbde8619481877b408b76a0b5b3f
BLAKE2b-256 84cf20dca274f3a6a078911e644859a4c5693c446802753da76e33bb5b9454ed

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