vector-cluster

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Vector Cluster

向量聚类

Cluster vectors in a namespace by semantic similarity using
ruvector
.
使用
ruvector
按语义相似度对命名空间中的向量进行聚类。

When to use

使用场景

Use this skill when you have a collection of embeddings and want to discover natural groupings. Clustering reveals themes, identifies outliers, and helps organize large vector collections.
当您拥有一组嵌入向量(embeddings)并希望发现自然分组时,可使用此技能。聚类能揭示主题、识别异常值,并帮助组织大型向量集合。

Steps

操作步骤

  1. Ensure ruvector is available:
    bash
    npm ls ruvector 2>/dev/null || npm install ruvector
  2. Run clustering:
    • With known cluster count:
      npx ruvector cluster --namespace NAMESPACE --k N
    • With auto-detection:
      npx ruvector cluster --namespace NAMESPACE --density
  3. Review output -- ruvector reports: cluster ID, label, member count, cohesion score, and outliers (for density mode)
  4. Store results:
    mcp__claude-flow__memory_store({ key: "clusters-NAMESPACE-TIMESTAMP", value: "CLUSTER_ASSIGNMENTS", namespace: "vector-clusters" })
  1. 确保ruvector可用
    bash
    npm ls ruvector 2>/dev/null || npm install ruvector
  2. 运行聚类
    • 指定聚类数量:
      npx ruvector cluster --namespace NAMESPACE --k N
    • 自动检测聚类:
      npx ruvector cluster --namespace NAMESPACE --density
  3. 查看输出——ruvector会报告:聚类ID、标签、成员数量、内聚分数,以及异常值(仅密度模式)
  4. 存储结果
    mcp__claude-flow__memory_store({ key: "clusters-NAMESPACE-TIMESTAMP", value: "CLUSTER_ASSIGNMENTS", namespace: "vector-clusters" })

Interpreting results

结果解读

  • High cohesion (>0.85): tight, well-defined cluster
  • Medium cohesion (0.6-0.85): related but diverse content
  • Low cohesion (<0.6): loose grouping, try higher k
  • Outliers: novel or anomalous entries worth investigating
  • 高内聚分数(>0.85):紧凑、定义清晰的聚类
  • 中等内聚分数(0.6-0.85):内容相关但具有多样性
  • 低内聚分数(<0.6):分组松散,尝试增大k值
  • 异常值:值得研究的新颖或异常条目

Graph-based clustering (ruvector v2.1+)

基于图的聚类(ruvector v2.1+)

ruvector supports Louvain community detection and spectral clustering for graph-structured data:
bash
npx ruvector hooks graph-cluster --namespace NAMESPACE
npx ruvector hooks graph-mincut --namespace NAMESPACE
ruvector支持针对图结构数据的Louvain社区检测和谱聚类:
bash
npx ruvector hooks graph-cluster --namespace NAMESPACE
npx ruvector hooks graph-mincut --namespace NAMESPACE