Documentation
README
Estimate online covariance with precise
precise provides sklearn-style estimators with a single partial_fit contract. Pure numpy.
pip install precise
The pattern
import numpy as np
from precise import EwaCovariance # exponentially weighted; recency-biased
est = EwaCovariance(r=0.05) # r in (0,1]; larger = faster forgetting
for y in stream: # y is a 1-D array (one observation)
est.partial_fit(y)
est.covariance_ # (d, d) ndarray, symmetric and PSD by construction
est.correlation_ # unit-diagonal correlation
est.precision_ # inverse covariance (when well-conditioned)
est.location_ # running mean
est.n_samples_ # observations seen
This is the opening of the README. Read the full README on GitHub.