code: def run_single_exp(config, dataset, model, root=None):
      print(
          "Run single experiment for {} and {}".format(dataset, model)
      )
      start_time = time.time()
      print("Started: ", start_time)
  
      hyperparams = config["hyperparams"][dataset][model]
      if hyperparams is None:
          print(
              "dataset {0}...model {1} \
                        experiment is not conducted yet...".format(
                  dataset, config["model_name_map"][model]
              )
          )
          return {"hyperparams": ".??"}
      print(
          "dataset {0}...model {1}...\
                    hyperparameter:...{2}".format(
              dataset, config["model_name_map"][model], hyperparams
          )
      )
  
      es_code = "{0}_{1}".format(dataset, model)
  
      load_func = getattr(
          ampligraph.datasets, config["load_function_map"][dataset]
      )
      X = (
          load_func()
      )  # The numeric values are stored in train/valid/test_numeric_values -> separate vector
      # logging.debug("Loaded...{0}...".format(dataset))
      model_name = model
      # load model
      model_class = getattr(
          ampligraph.compat, config["model_name_map"][model]
      )
      model = model_class(**hyperparams)
      # Fit the model on training and validation set
  
      # focusE
      focusE_weights_train = X.get("train_numeric_values", None)
      focusE_weights_valid = X.get("valid_numeric_values", None)
      focusE_weights_test = X.get("test_numeric_values", None)
  
      if focusE_weights_train is not None:
          X["train"] = np.concatenate(
              [X["train"], focusE_weights_train], axis=1
          )
      if focusE_weights_valid is not None:
          X["valid"] = np.concatenate(
              [X["valid"], focusE_weights_valid], axis=1
          )
      if focusE_weights_test is not None:
          X["test"] = np.concatenate(
              [X["test"], focusE_weights_test], axis=1
          )
  
      # The entire dataset will be used to filter out false positives statements
      # created by the corruption procedure:
  
      filter = np.concatenate((X["train"], X["valid"], X["test"]))
  
      if es_code in config["no_early_stopping"]:
          logging.debug("Fit without early stopping...")
          model.fit(X["train"])
      else:
          logging.debug("Fit with early stopping...")
          model.fit(
              X["train"],
              True,
              {
                  "x_valid": X["valid"][::2],
                  "criteria": "mrr",
                  "x_filter": filter,
                  "stop_interval": 4,
                  "burn_in": 0,
                  "check_interval": 50,
              },
          )
  
      if (
          not hasattr(model.model, "early_stopping_epoch")
          or model.model.early_stopping_epoch is None
      ):
          early_stopping_epoch = np.nan
      else:
          early_stopping_epoch = model.model.early_stopping_epoch
  
      if root is not None:
          fmt = "%Y-%m-%d-%H-%M-%S"
          date = datetime.datetime.now().strftime(fmt)
          name = "{}/{}-{}-{}".format(root, model_name, dataset, date)
          save_model(model, name)
          print("Model saved in {}.".format(name))
  
      # Run the evaluation procedure on the test set. Will create filtered rankings.
      # To disable filtering: filter_triples=None
      ranks = evaluate_performance(
          X["test"], model, filter, verbose=False
      )
  
      # compute and print metrics:
      mr = mr_score(ranks)
      mrr = mrr_score(ranks)
      hits_1 = hits_at_n_score(ranks, n=1)
      hits_3 = hits_at_n_score(ranks, n=3)
      hits_10 = hits_at_n_score(ranks, n=10)
  
      result = {
          "mr": mr,
          "mrr": mrr,
          "H@1": hits_1,
          "H@3": hits_3,
          "H@10": hits_10,
          "hyperparams": hyperparams,
          "time": time.time() - start_time,
          "early_stopping_epoch": early_stopping_epoch,
      }
      if root is not None:
          name = "{}/result_{}_{}_{}.json".format(
              root, model_name, dataset, date
          )
          with open(name, "w") as f:
              f.write(json.dumps(result))
          print("Results saved in the file: {}".format(name))
  
      return result
  
imports: import os
  import argparse
  import datetime
  import itertools
  import json
  import logging
  import sys
  import time
  import warnings
  import numpy
  import tensorflow
  import yaml
  from beautifultable import BeautifulTable
  from docopt import docopt
  from schema import And, Schema, Use
  from tqdm import tqdm
  import ampligraph.datasets
  from ampligraph.compat import evaluate_performance
  from ampligraph.evaluation import hits_at_n_score, mr_score, mrr_score
  from ampligraph.utils import save_model
label_desc: Use image node_id 2 for calling a global function with example usage: run_single_exp(config, dataset, model, root) and returns: result, dict