embed
できること
このスキルは、Semanticaのナレッジグラフの項目について、エンベディングと呼ばれる数値の指紋を作ります。似た項目を見つけたい、または新しい結びつきが起こりやすいかを推定したい人向けです。
使う場面
- ✓グラフの中から、選んだ項目に似た項目を見つけたいとき。
- ✓項目どうしの欠けているリンクのうち、起こりやすいものを推定したいとき。
- ✓類似度のために、多くの項目のペアを一度に比べたいとき。
スキルのリンク
https://github.com/semantica-agi/semantica/blob/main/plugins/skills/embed/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私のナレッジグラフの中で、Acmeの顧客記録に最も似ている10個のノードを見つけてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントはランダムウォークの方法を使って、ノードのエンベディングを計算します。必要に応じてノードに保存でき、その後それらを比べて、近い一致や起こりやすいリンクを見つけます。結果は順位付けされたリストとして返されます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
/semantica:embed
Generate and inspect graph embeddings. Usage: /semantica:embed <sub-command> [args]
$ARGUMENTS = sub-command + arguments.
compute [--labels <t1,t2>] [--rels <r1,r2>] [--dim N] [--walks N]
Generate Node2Vec embeddings for graph nodes.
from semantica.kg.node_embeddings import NodeEmbedder
from semantica.context import ContextGraph
graph = ContextGraph()
embedder = NodeEmbedder()
node_labels = labels_arg.split(",") if labels_arg else graph.get_all_node_types()
rel_types = rels_arg.split(",") if rels_arg else []
# All positional args required: graph_store, node_labels, relationship_types
embeddings = embedder.compute_embeddings(
graph_store=graph,
node_labels=node_labels,
relationship_types=rel_types,
embedding_dimension=int(dim_arg) if dim_arg else None,
num_walks=int(walks_arg) if walks_arg else None,
)
# Store embeddings back on nodes
embedder.store_embeddings(
graph_store=graph,
embeddings=embeddings,
property_name="node2vec_embedding",
)
Output:
Embeddings computed and stored.
Nodes embedded: N
Embedding dim: 128
Node types covered: [type1, type2, ...]
Sample (first 5 nodes):
| Node | Type | Embedding dim | Stored |
similar <node_id> [--top N]
Find the most similar nodes to a given node in embedding space.
from semantica.kg.node_embeddings import NodeEmbedder
from semantica.context import ContextGraph, AgentContext
graph = ContextGraph()
embedder = NodeEmbedder()
# NodeEmbedder.find_similar_nodes uses the stored node2vec_embedding property
neighbors = embedder.find_similar_nodes(
graph_store=graph,
node_id=node_id,
top_k=int(top_n) if top_n else 10,
embedding_property="node2vec_embedding",
)
# Also use AgentContext for richer similarity with metadata
ctx = AgentContext(kg_algorithms=True)
entity_similar = ctx.find_similar_entities(
entity_id=node_id,
similarity_type="content", # or "structural", "hybrid"
top_k=int(top_n) if top_n else 10,
)
Return: | Rank | Node ID | Type | Cosine Similarity | Shared Properties |
similarity <n1> <n2> [--method cosine|euclidean|manhattan|correlation]
Compute pairwise similarity between two nodes.
from semantica.kg.similarity_calculator import SimilarityCalculator
from semantica.kg.node_embeddings import NodeEmbedder
from semantica.context import ContextGraph
graph = ContextGraph()
embedder = NodeEmbedder()
calc = SimilarityCalculator()
# Get embeddings for both nodes
v1 = embedder.find_similar_nodes(graph, n1, top_k=1) # placeholder — use stored embedding
v2 = embedder.find_similar_nodes(graph, n2, top_k=1)
method = method_arg or "cosine"
if method == "cosine":
score = calc.cosine_similarity(vector1=v1, vector2=v2)
elif method == "euclidean":
score = calc.euclidean_distance(v1, v2)
elif method == "manhattan":
score = calc.manhattan_distance(v1, v2)
elif method == "correlation":
score = calc.correlation_similarity(v1, v2)
Output:
Similarity: "<n1>" ↔ "<n2>"
Method: cosine
Score: 0.847
Interpretation: HIGH similarity (>0.8)
Shared neighbors: K
Common node types: [types]
predict-link <n1> <n2> [--method cosine|jaccard|adamic-adar|common-neighbors]
Score the likelihood of a relationship between two nodes.
from semantica.kg.link_predictor import LinkPredictor
from semantica.context import ContextGraph
graph = ContextGraph()
predictor = LinkPredictor()
# score_link(graph_store, node_id1, node_id2, method=)
score = predictor.score_link(
graph_store=graph,
node_id1=n1,
node_id2=n2,
method=method_arg or None,
)
Output:
Link Prediction: "<n1>" → "<n2>"
Method: cosine
Score: 0.723 (threshold: 0.5 → LIKELY)
Recommendation: This link is LIKELY to be meaningful.
top-links <node_id> [--top N] [--method <method>]
Find the top-N most likely new connections for a node.
from semantica.kg.link_predictor import LinkPredictor
from semantica.context import ContextGraph
graph = ContextGraph()
predictor = LinkPredictor()
top = predictor.predict_top_links(
graph_store=graph,
node_id=node_id,
top_k=int(top_n) if top_n else 10,
method=method_arg or None,
)
Return: | Rank | Target Node | Type | Score | Existing Link? |
batch <query_node> [--against <n1,n2,...>] [--top N]
Score similarity between a query node and a set of target nodes (or all
よくある質問
エンベディングとは何ですか?
項目を表す数値のリストで、似た項目が似た数値を持つようにしたものです。
エンベディングは保存されますか?
はい。結果は後で使えるよう、各ノードに保存できます。
まだ存在しないリンクも評価できますか?
はい。このスキルは、ノードの間の起こりうる新しいリンクを評価できます。
詳細
作者による元の説明
Generate, inspect, and use node/text embeddings in Semantica — compute Node2Vec embeddings, find similar nodes, score link predictions, batch similarity, and pairwise similarity. Uses NodeEmbedder, SimilarityCalculator, LinkPredictor, and AgentContext. Sub-commands: compute, similar, similarity, predict-link, top-links, batch, pairwise.
repo: semantica-agi/semantica
人気
- GitHubのスター
- 14k
- ランキング
- #11146
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
semantica
14kエージェントが、ナレッジグラフのための総合的なツールキットを使えるよう支援します。抽出、推論、来歴、オントロジー、ポリシー、エクスポートを扱います。
causal
14kエージェントが、ナレッジグラフの中の因果関係をたどり、原因の連鎖、もしもの場合のシナリオ、影響のスコアを扱えるよう支援します。
change
14kエージェントが、ナレッジグラフの過去の時点での状態と、2つの日付または2つのオントロジーのバージョンの間の変更点を示せるよう支援します。
decision
14kエージェントが、最初のメモから結果までを含め、ナレッジグラフ内の判断を記録、検索、説明、見直せるよう支援します。