Commit 2d32ce67 authored by markus's avatar markus
Browse files

create embeddings

parent 02786270
This diff is collapsed.
......@@ -29,8 +29,9 @@ def _create_embeddings(tsv_file : str) -> dict:
model='TransE',
training=training,
testing=testing,
model_kwargs=dict(embedding_dim=8),
training_kwargs=dict(num_epochs=64, use_tqdm_batch=False),
model_kwargs=dict(embedding_dim=16),
training_kwargs=dict(num_epochs=64, use_tqdm_batch=False, batch_size=500),
negative_sampler = "bernoulli",
)
# Extract embeddings and map id to entitiy
......
......@@ -71,11 +71,11 @@ def extract_resources(g: Graph, lp: int):
return included_res, excluded_res
g1 = read(path='data/kg-mini-project-train.ttl', format='turtle')
#g2 = read(path='data/carcinogenesis.owl', format='application/rdf+xml')
#g1 = read(path='data/kg-mini-project-train.ttl', format='turtle')
g2 = read(path='data/carcinogenesis.owl', format='application/rdf+xml')
run_knn(g1, "data/embeddings_carcinogenesis.tsv", 4)
#run_knn(g1, "data/embeddings_carcinogenesis.tsv", 4)
#generate_and_save_embeddings(g2, "data/carcinogenesis.tsv", "data/embeddings_carcinogenesis.tsv")
generate_and_save_embeddings(g2, "data/carcinogenesis.tsv", "data/embeddings/embeddings_carcinogenesis_transe_16dim.tsv")
#for lp in range(1, 26):
# print(extract_resources(g1, lp))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment