Skip to content

Repository files navigation

Cruising through the space of knowledge with HAL

You can fly through different embedding spaces. Embeddings are multidimensional arrays, that model information about the occurrence of something in context of another thing.

One thing is to cruise through knowledge graph embeddings created with ampligraph, dimension-reduced to 3d. The graph is taken from the wordnet 3.1. dictionary, containing semantic information about similarity, antonymy, hyperonymy and hyponymy and other.

Another is projecting only probabilistic knowledge about semantics to 3d. For example such created with gensim

Prerequisits: Get embeddigns and Database

  • Install Neo4j

  • Adjust configuration in neo4j.conf.

    • enable reading external files

      Comment/uncomment these lines in neo4j.conf (you find a sample of this file in this directory)

dbms.security.allow_csv_import_from_file_urls=true
dbms.directories.import=import

Increase its heap size:

dbms.memory.heap.max_size=3G
  • disable authorization for neo4j, because the authentication of the java-driver is more difficult than thought
dbms.security.auth_enabled=false
CREATE INDEX ON :Node(name)

Load the Synstes as words - adapt the path

LOAD CSV WITH HEADERS FROM 'file:////home/stefan/eclipse-workspace/hal/data/knowledge_graph_3d_choords.csv' AS line
CREATE (:Node { 
	name: line.name, id:line.id, 
	x_pca:toFloat(line.x_pca), y_pca:toFloat(line.y_pca), z_pca:toFloat(line.z_pca), 
	x_tsne:toFloat(line.x_tsne), y_tsne:toFloat(line.y_tsne), z_tsne:toFloat(line.z_tsne), 
	x_k2:toFloat(line.x_k2), y_k2:toFloat(line.y_k2), z_k2:toFloat(line.z_k2), cl_pca:toInteger(line.cl_pca), cl_tsne:toInteger(line.cl_tsne),	cl_k2:toInteger(line.cl_k2), cl_kn:toInteger(line.cl_kn)})

Load relationships (wordnet synonyms, anotnyms, hyponyms) - adapt the path

LOAD CSV WITH HEADERS FROM 'file:///home/.../eclipse-workspace/hal/knowledge_graph_rels.csv' AS line
MATCH (n1:Node {name:line.n1}), (n2:Node {name:line.n2})
WHERE id(n1)>id(n2)
MERGE (n1)-[:R{kind:line.rel}]->(n2)

In need to delete all neo4j content:

MATCH (n) DETACH DELETE n;

Run and Cruise

Press play cruise

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages