教授本地神经网络阅读政治录音:向量、交易以及您如何提供帮助

posted in: Uncategorized | 0

政治市场受故事影响。只有当我们将故事转化为数字时,机器才会“阅读”这些故事。本周 3DN 为 PolitiCap 建立了一个小型本地机器学习支柱:每篇英文桌面文章都嵌入到 Postgres 向量数据库中,然后与公民磁带上的实际执行交易相连接。目标不是赌场水晶球。这是一个 本地、可检查的模型,可能最终有助于预测虚拟交易所的短期政治波动——如果社区产生足够诚实的交易活动可以从中学习。

注册并交易: politicap.eu — 免费账户,dibs(虚拟 DutchBud 信用)在一个闭环账本上。更多真实新闻事件后的交易 = 网络更好的标签。

我们构建的

管道故意设计得乏味且本地化:

  1. EN 文章 在 politicap.eu (正文中有漂亮的链接交易所代码)。
  2. 嵌入器 sentence-transformers/all-MiniLM-L6-v2 → 384 维向量(与我们的车队 RAG 同一家族)。
  3. Postgres 数据库 politicap_mlpgvector (HNSW 余弦索引)。
  4. ETL 构建 article_symbol_windows:对于每篇文章×交易所代码×地平线,在发布时间后拉取执行订单。
从 EN 桌面文章到 Postgres 和交易窗口的 MiniLM 嵌入管道

向量:什么是“相似性”

每篇英文帖子都成为 ℝ384 中的一个单位向量 e。正文的块有自己的向量,以便更精细地检索。该空间中的相邻点往往具有共同的主题(AI 竞赛,TRUMPD 地缘政治,荷兰内阁电报)。

文章嵌入集群的二维投影图

两个 L2 规范化向量 uv 之间的余弦相似度简化为一个简单的点积:

sim(u, v) = (u · v) / (‖u‖ ‖v‖) = uᵀ v

这对于“像这样的一篇文章”很有用。它 不是 自己的价格预测。交易通过不同的门进入。

交易如何与嵌入关联

我们从未将订单 ID 塞入向量。连接是一个 事件支柱

  • article_tickers.symbol — 故事是关于谁的(来自 data-symbol 美观的链接)。
  • articles.published_at = t₀ — 新闻事件开始时间(UTC)。
  • Horizons H ∈ {5 min, 30 min, 2 h, 1 day} — 只有 t₀ 之后的活动才算作反应。
事件窗口图,包含回报公式

对于窗口中的最后价格 P 和执行量 V:

  • 简单回报: r_H = P(t₀+H) / P(t₀) − 1
  • 对数回报: ℓ_H = ln P(t₀+H) − ln P(t₀)
  • 成交量冲击: z_H = (V_after − V_prev) / max(V_prev, 1) 比较事件后窗口与 t₀ 之前的相同长度窗口

这些数字位于 article_symbol_windows 中,紧邻嵌入式。该表是神经网络(或一个乏味的梯度提升器)实际训练的内容。

一个预测模型 — 没有炒作

余弦相似度和训练行公式

训练行如下:

x = [ e_doc ‖ f_pre(s, t₀) ‖ 1_s ]
ŷ_H = g_θ(x) ≈ r_H 或 sign(r_H) 或“成交量飙升”

这里 e_doc 是冻结的文章嵌入,f_pre 是新闻之前的市场特征(因此我们不泄露答案),1_s 标记符号。先从冻结的 MiniLM 特征开始,使用岭回归或梯度提升。然后才是一个小神经网络。按时间向前分割。先击败一个愚蠢的基线。

免责声明: PolitiCap 是一款带有虚拟 DutchBud 信用的公民游戏 — 不提供证券许可建议,也不是可兑现法定现金的预测市场。一个“成功的”模型意味着更好地描述虚拟磁带动态,而不是你在现实世界中可以依赖的保证。

第一张地图:与新闻相关的 1 天成交量最高的 10 个符号

在嵌入 203 篇英文帖子并加入 ~247k 笔成交量后,这些符号在 1 天事件窗口中拥有最多的文章后成交量(跨标记故事求和 – 重叠的 AI 帖子可以共享同一天的磁带):

与新闻相关的 1 天成交量最高的 10 个符号的条形图
# Symbol 1d volume (sum) Top news drivers (by window volume)
1 AI 867 247 Let there be Light; China AI slowdown “Cold War playbook”
2 TRUMPD 757 480 GROKAI learns candles; TRUMPD Iran-plan tape; Taiwan survey
3 GROKAI 627 238 Let there be Light; China AI slowdown; AI Index free-float soak
4 MUSKE 606 844 FBI Grassley emails; MUSKE/MENGW IPO; candles battle note
5 CHATGPT 579 296 Let there be Light; China AI slowdown; free-float soak
6 METAAI 493 536 Same Battle / AI-index cluster
7 GEMINAI 470 226 Same Battle / AI-index cluster
8 DEEPSEK 410 550 Same Battle / AI-index cluster
9 LIANGW 236 176 GROKAI learns candles (primary)
10 ALTMS 204 734 GROKAI learns candles; Grok 4.7 desk note

Pattern: Battle of the AIs listings and TRUMPD/MUSKE geopolitics dominate labeled volume. That is exactly the kind of repeated event structure a local model can learn — if humans keep showing up on the book when the desk drops a wire.

How people make the model better

  1. Trade after real news — your fills become (symbol, t₀, H) labels. Thin books teach noise.
  2. Use the ticker links — pretty-links are the join keys into the tape.
  3. Do not game empty symbols — wash volume without news confounds the windows.
  4. Stay on the closed loop — dibs / DutchBud virtual bank language keeps the civic market honest: fintech spine, not casino cash-out.

Create a PolitiCap account → play the civic market, leave a trail of trades the lab can learn from.

Stack notes (for the curious)

  • DB: politicap_ml on fleet Postgres with pgvector
  • Embed on publish: desk skill runs embed_en.py --only-id for every EN post
  • Windows ETL: executed orders (status=E) from the PolitiCap MySQL book
  • Next: walk-forward baselines, then a small net — still local, still ours

3DN 构建了基础设施:主权计算习惯、开放工具和我们手指下的产品。预测性公民磁带是堆栈(托管、银行、市场、PolitiCap)属于一起的另一个原因。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注