Skip to main content

Online covariance and precision estimation

Project description

precise

A collection of autonomous online (incremental) covariance matrix estimators.

Install

pip install precise 

Examples

See /examples_basic_usage

Explanation

You use state updaters, then functions of the state.

State updates

All updaters take a prior state and return a posterior state (dict). An empty dict is passed to initialize.

Example:

from precise.synthetic.generate import create_correlated_dataset
from precise.covariance.empirical import emp_pcov

if __name__=='__main__':
    xs = create_correlated_dataset(n=500)
    s = {}
    for x in xs:
        s = emp_pcov(s=s, x=x)
    pprint(s['scov'])

Naming hints:

Shorthand Intent
scov Sample covariance
pcov Population covariance
spre Sample precision
ppre Population precision

Method hints:

Shorthand Meaning
emp Empirical
ema Exponential weighted moving average
lz Le-Zhong variable-by-variable updating
lw (inspired by) Ledoit-Wolf

Some, such as OAS, don't need their own state tracking. See examples.

State functions & mutations

Three types of utilities exist

  1. The covariance/statefunctions are illustrated by the example running_oas_covariance.
  2. State covariatnce/statemutations do things like ensuring both covariance and precision matrices exist in the state. Or for instance: s = both_cov(s) ensures both sample and population covariances are present.
  3. Miscellaneous /covariance/matrixfunctions functions act directly on matrices.

Updater hyper-parameters

The intent is that methods are parameter free. However some not-quite autonomous methods admit just one additional scalar parameter r and that can make the creation of fully autonomous methods simpler, akin to the tuning of skaters explained here in the timemachines package.

Miscellaneous

  • Care to cite, some ideas here
  • If you just want univariate, and don't want numpy as a dependency, there is momentum.

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

precise-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

precise-0.1.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: precise-0.1.0.tar.gz
  • Upload date:
  • Size: 14.7 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.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for precise-0.1.0.tar.gz
Algorithm Hash digest
SHA256 95207d33def068465e85973507bc6d3ae17ae432c82693fd6670103fbbedc800
MD5 2ba5d9e3987d01c1b5e26df618553518
BLAKE2b-256 eb6d1867dde166b59f02cbd33ff28e5e36e572159aa33b8cb882263c9699d41e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: precise-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 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.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for precise-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 794cf1cf85ac47b81e2687c76f9ac19cdd9ce30be22bd59e35684ae1f157abd0
MD5 f57dd9e7be7b782e110428a73d249c51
BLAKE2b-256 df8bd9d19ec2ee9528f282669ef37f509174cbd2fca00b2e977c6732abb467dd

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