vector-hyperbolic

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Vector Hyperbolic

Vector Hyperbolic

Embed hierarchical data in the Poincare ball model using
ruvector
.
使用
ruvector
将层级数据嵌入Poincare球模型。

When to use

何时使用

Use this skill when your data has inherent hierarchy — dependency trees, module structures, taxonomies, org charts, ontologies. Hyperbolic space captures hierarchical distances with far fewer dimensions than Euclidean embeddings.
当你的数据具有固有层级结构时使用此技能——比如依赖树、模块结构、分类体系、组织结构图、本体论。双曲空间能够用远少于欧几里得嵌入的维度捕捉层级距离。

Steps

步骤

  1. Ensure ruvector is available:
    bash
    npm ls ruvector 2>/dev/null || npm install ruvector
  2. Embed in Poincare ball:
    bash
    npx ruvector embed --model poincare "hierarchical concept"
    Coordinates near origin = generic/root; near boundary = specific/leaf.
  3. Search in hyperbolic space:
    bash
    npx ruvector search --model poincare "query" --limit 10
  4. Geodesic distance:
    d(u, v) = arcosh(1 + 2 * ||u-v||^2 / ((1-||u||^2)(1-||v||^2)))
    Distance grows logarithmically with tree depth, preserving hierarchy.
  5. Store results:
    mcp__claude-flow__memory_store({ key: "hyperbolic-CONCEPT", value: "COORDINATES_AND_NEIGHBORS", namespace: "hyperbolic-embeddings" })
  1. 确保ruvector可用:
    bash
    npm ls ruvector 2>/dev/null || npm install ruvector
  2. 嵌入到Poincare球中:
    bash
    npx ruvector embed --model poincare "hierarchical concept"
    靠近原点的坐标 = 通用/根节点概念;靠近边界的坐标 = 特定/叶子节点概念。
  3. 在双曲空间中搜索:
    bash
    npx ruvector search --model poincare "query" --limit 10
  4. 测地距离:
    d(u, v) = arcosh(1 + 2 * ||u-v||^2 / ((1-||u||^2)(1-||v||^2)))
    距离随树深度呈对数增长,保留层级结构。
  5. 存储结果:
    mcp__claude-flow__memory_store({ key: "hyperbolic-CONCEPT", value: "COORDINATES_AND_NEIGHBORS", namespace: "hyperbolic-embeddings" })

Poincare ball properties

Poincare球属性

PropertyMeaning
Norm close to 0Generic, root-level concept
Norm close to 1Specific, leaf-level concept
Small geodesic distanceClosely related in hierarchy
Large geodesic distanceDistant or different subtrees
属性含义
范数接近0通用、根层级概念
范数接近1特定、叶子层级概念
测地距离小在层级结构中关系密切
测地距离大属于遥远或不同的子树

Use cases

使用场景

  • Dependency analysis: embed module imports to find tightly coupled subtrees
  • Code architecture: map class hierarchies to discover structural patterns
  • Knowledge organization: embed concepts to reveal taxonomic relationships
  • Codebase navigation: find most specific/general modules relative to a query
  • 依赖分析: 嵌入模块导入关系以找到耦合紧密的子树
  • 代码架构: 映射类层级结构以发现结构模式
  • 知识组织: 嵌入概念以揭示分类关系
  • 代码库导航: 找到与查询相关的最具体/最通用模块