Skip to content
Skillpedia
Machine learning14k · #11146

embed

What it does

This skill creates numeric fingerprints, called embeddings, for the items in a Semantica knowledge graph. It is for people who want to find similar items or estimate which new connections are likely.

When to use it

  • ✓When you want to find items in the graph that are similar to a chosen one.
  • ✓When you want to estimate which missing links between items are likely.
  • ✓When you want to compare many pairs of items at once for similarity.

Skill link

https://github.com/semantica-agi/semantica/blob/main/plugins/skills/embed/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/semantica-agi/semantica/blob/main/plugins/skills/embed/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Can you find the 10 nodes in my knowledge graph most similar to the customer record for Acme?”

5 new skills a week. 1 minute to read.

How it works

The agent computes embeddings for the nodes using a random-walk method, can store them back on the nodes, and then compares them to find close matches or likely links. The results come back as ranked lists.

Technical content (original SKILL.md)

Original text by the author, straight from 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

FAQ

What is an embedding?

It is a list of numbers that represents an item, so that similar items get similar numbers.

Does it save the embeddings?

Yes. The results can be stored back on each node for later use.

Can it score links that do not exist yet?

Yes. The skill can score possible new links between nodes.

Details

Original description by the author

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

Popularity

GitHub stars
14k
Ranking position
#11146
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills