Online covariance and precision estimation
Project description
precise
A collection of autonomous online (incremental) covariance matrix estimators.
Install
pip install precise
Examples
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
- The covariance/statefunctions are illustrated by the example running_oas_covariance.
- 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.
- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.