Commit 6e5caccb authored by Markus Roese's avatar Markus Roese
Browse files

updated embeddings

parent 89f39ca9
from rdflib import Graph
from pykeen.triples import TriplesFactory
from pykeen.pipeline import pipeline
import os.path
def _create_tsv(g: Graph, tsv_target_file : str):
"""
......@@ -8,6 +9,8 @@ def _create_tsv(g: Graph, tsv_target_file : str):
:param g: Graph to write
:param tsv_target_file: Where to write .tsv file
"""
if os.path.isfile(tsv_target_file):
return
with open(tsv_target_file, "w") as f:
for subj, pred, obj in g:
f.write(f"{subj}\t{pred}\t{obj}\n")
......@@ -31,7 +34,7 @@ def _create_embeddings(tsv_file : str, model_name : str = "TransE", dim : int =
training=training,
testing=testing,
model_kwargs=dict(embedding_dim=dim),
training_kwargs=dict(num_epochs=64, use_tqdm_batch=False),
training_kwargs=dict(num_epochs=8, use_tqdm_batch=False),
negative_sampler = "bernoulli",
)
......
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