<jupyter_start><jupyter_text>print(sys.version)<jupyter_code>print(time.asctime())
print(pykeen.get_version())<jupyter_output>0.0.26-dev<jupyter_text>Check which hyper-parameters are required by ConvE:<jupyter_code>ConvE.hyper_params<jupyter_output><empty_output><jupyter_text>Define output directory:<jupyter_code>output_directory = os.path.join(
    os.path.expanduser('~'), 
    'Desktop', 
    'pykeen_test'
)<jupyter_output><empty_output><jupyter_text>Define hyper-parameters: Note: ConvE_height * ConvE_width == embedding_dim Note: ConvE_kernel_height <= ConvE_height Note: ConvE_kernel_width <= ConvE_width Train ConvE:<jupyter_code># Load data
from pykeen.utilities.pipeline import prepare_data
triples, entity_label_to_id, relation_label_to_id, all_entities, num_entities, num_relations = prepare_data('../../tests/resources/data/rdf.nt')
# For the new model
config = dict(
    random_seed                 = 0,
    embedding_dim               = 200,
    ConvE_input_channels        = 1,  
    ConvE_output_channels       = 32,  
    ConvE_height                = 10,
    ConvE_width                 = 20,
    ConvE_kernel_height         = 3,
    ConvE_kernel_width          = 3,
    conv_e_input_dropout        = 0.0,
    conv_e_feature_map_dropout  = 0.0,
    conv_e_output_dropout       = 0.0,
    margin_loss                 = 1,
    preferred_device            = 'gpu',
    num_entities = num_entities,
    num_relations = num_relations
)
model = ConvE(**config)
fit_config=dict(
    learning_rate               = 0.001,
    num_epochs                  = 20,  
    batch_size                  = 128,
)
losses = model.fit(all_entities, triples, **fit_config)<jupyter_output>INFO:pykeen.kge_models.base:****Run Model On CUDA****
Training epoch: 100%|██████████| 20/20 [00:00<00:00, 97.08it/s]
INFO:pykeen.kge_models.base:Training took 0 seconds<jupyter_text>Access trained model:<jupyter_code>model<jupyter_output><empty_output><jupyter_text>Visualize loss values:<jupyter_code>epochs = np.arange(len(losses))
plt.title(r'Loss Per Epoch')
plt.xlabel('epoch')
plt.ylabel('loss')
plt.plot(epochs, losses)
plt.show()<jupyter_output><empty_output><jupyter_text>Move model to cpu<jupyter_code>model._to_cpu()<jupyter_output><empty_output><jupyter_text>Load test triples<jupyter_code>test_triples, _, _, _, _, _ = prepare_data('../../tests/resources/data/rdf.nt')<jupyter_output><empty_output><jupyter_text>Calculate results<jupyter_code>from pykeen.utilities.evaluation_utils.metrics_computations import compute_metric_results
results = compute_metric_results(all_entities=all_entities, kg_embedding_model=model, mapped_train_triples=triples, 
                                mapped_test_triples=test_triples, device = model.device, filter_neg_triples=False)
results<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11241970021413276, 'fraction_numerical': 0.01891506067094932, 'mean_word_length': 4.219739292364991, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '394208', 'license': 'MIT', 'n_tokens_mistral': 1062, 'n_tokens_neox': 989, 'n_words': 135, 'path': 'notebooks/training_of_kge_models/NEW_API_Train ConvE on RDF.ipynb', 'repo_name': 'lvermue/PyKEEN', 'size': '2802'}