跳到正文
cccskills
免费在 GitHub 公开

estimate-online-covariance

Estimate a covariance / correlation / precision matrix incrementally with precise. Use when data arrives as a stream and you want the matrix updated per observation, or when you want an online (partial_fit) drop-in for sklearn.covariance, which is batch-only.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md2.1 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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

fit(X) is the batch drop-in (X is 2-D, rows = observations); it resets then replays rows, so it matches sklearn.covariance's call shape.

Choosing the class

all_estimators() lists every estimator; estimator_from_name("LedoitWolfCovariance") looks one up. Sensible defaults by situation:

  • general / recency-weighted: EwaCovariance(r=...)
  • many variables relative to samples (p/n large) or ill-conditioned: LedoitWolfCovariance, OASCovariance, ShrunkCovariance, FactorCovariance
  • heavy tails / outliers: HuberCovariance, TylerCovariance
  • regime changes: AdaptiveEwaCovariance, DCCCovariance
  • you don't know: use the choose-covariance-estimator skill (suggest(X)).

Notes

  • All estimators are truly online — constant work per observation, no growing buffers.
  • State is a JSON-able dict: est.get_state() / est.set_state(s) for mid-stream checkpointing.
  • covariance_ is always symmetric PSD; don't hand-symmetrize or clip it yourself.
  • Named series with a changing universe? Use the keyed-dynamic-universe skill instead.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Rigorously and honestly assess a NEW or proposed covariance / correlation / precision estimator, or a new covariance scoring rule, using precise. Use when someone proposes, asks to evaluate, or wants to compare a covariance methodology. Covers implementing it to the contract, conformance, benchmarking against the registry, out-of-sample validation, and statistically defensible inference.

中文简介正在准备中。当前显示原文说明。

microprediction/precise3372026年10月6日 更新

Pick which precise covariance estimator to use for a given dataset. Use when you have data X and are unsure which estimator fits its dimension, conditioning, or tail behavior. Wraps precise.suggest() and covariance_features().

中文简介正在准备中。当前显示原文说明。

microprediction/precise3372026年10月6日 更新

Maintain an online covariance over named series whose set changes over time (e.g. assets entering and leaving). Use when observations arrive as dicts keyed by name rather than fixed-length vectors. Wraps precise's keyed / FixedUniverse / DynamicUniverse adapters.

中文简介正在准备中。当前显示原文说明。

microprediction/precise3372026年10月6日 更新

precise

免费

Online (incremental) covariance, correlation, and precision estimation in Python — the streaming complement to sklearn.covariance. Use when code needs a covariance/correlation matrix updated per observation, recomputes np.cov/np.corrcoef in a rolling loop, must judge or compare covariance estimates, or proposes a new covariance methodology. Points to task-specific skills.

中文简介正在准备中。当前显示原文说明。

microprediction/precise3372026年10月6日 更新

Score and compare covariance estimates with precise's assessor panel. Use when you need to judge an estimate out-of-sample or rank competing estimators — and especially in high dimensions, where the plain held-out likelihood is misleading.

中文简介正在准备中。当前显示原文说明。

microprediction/precise3372026年10月6日 更新

查看 microprediction 的全部技能

报告此技能的问题