‹ 首页

keyed-dynamic-universe

@microprediction · 收录于 2 天前 · 上游提交 1 个月前

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.

适合你,如果资产列表不断变化且需要实时协方差矩阵

/ 通过 npx 安装 校验哈希
npx oh-my-skill add microprediction/precise/keyed-dynamic-universe
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- microprediction/precise/keyed-dynamic-universe
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify microprediction/precise/keyed-dynamic-universe
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
333GitHub stars
~412上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 d89c883 · 表述以原文为准
它做什么

安装后,Claude 能维护一个随名称集合变化而更新的协方差矩阵。它接受以字典形式(如 {"BTC":0.01})输入的观测,自动处理新名称加入或旧名称退出,并输出一个按名称索引的协方差矩阵。

什么时候触发

当你以字典形式(keyed dict)提供观测数据,例如金融资产收益率序列,且名称集合可能随时间变化时触发。

装好后可以这样说
返回当前协方差矩阵中对应项
新名称自动纳入计算
输出字典或DataFrame
技能原文 SKILL.md作者撰写 · MIT · d89c883

Keyed covariance over a changing universe

In streaming/finance settings observations are dicts keyed by name, and the set of names changes. keyed decorates any positional estimator to consume keyed dicts and emit keyed output.

pip install precise            # add [pandas] for to_frame()
from precise import keyed, EwaCovariance

est = keyed(EwaCovariance(r=0.05), dynamic=True)     # universe may change over time
est.partial_fit({"BTC": 0.01, "ETH": -0.02})         # river-style: also .update / .learn_one
est.partial_fit({"ETH": 0.00, "SOL": 0.03})          # BTC drops out, SOL enters

est.covariance_["ETH"]["SOL"]                         # dict-of-dicts over the live universe
est.to_frame()                                        # pandas DataFrame  (needs [pandas])
Fixed vs dynamic
  • keyed(est) / dynamic=FalseFixedUniverse: one wrapped estimator; missing keys are imputed. Use when the set of names is stable and you just want dict ergonomics.
  • keyed(est, dynamic=True)DynamicUniverse: tracks multiple live key-sets with staleness / longevity eviction and assembles a pairwise matrix. Use when names genuinely enter and leave.
Notes
  • The adapter adds no covariance math of its own — it wraps the positional estimator, so any estimator from the estimate-online-covariance skill works inside it (LedoitWolfCovariance, HuberCovariance, …).
  • The assembled matrix is projected to the nearest PSD; expect small adjustments when the live universe changes.
  • To score/compare keyed estimators, extract the dense covariance_ (e.g. via to_frame().values) and use the score-covariance-estimate skill.
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。