code: def generate_focusE_dataset_splits(
      dataset, split_test_into_top_bottom=True, split_threshold=0.1
  ):
      """Creates the dataset splits for training models with FocusE layers
  
      Parameters
      ----------
      dataset: dict
          Dictionary of train, test, valid datasets of size (n,m) - where m>3. The first 3 cols are `subject`,
          `predicate`, and `object`. Afterwards, is the numeric values (potentially multiple) associated with each triple.
  
      split_test_into_top_bottom: bool
          Splits the test set by numeric values and returns `test_top_split` and `test_bottom_split` by splitting
          based on sorted numeric values and returning top and bottom k*100% triples, where `k` is specified by
          `split_threshold` argument.
  
      split_threshold: float
          Specifies the top and bottom percentage of triples to return.
  
      Returns
      -------
      splits: dict
          The dataset splits: `{'train': train,
                               'train_numeric_values': train_numeric_values,
                               'valid': valid,
                               'valid_numeric_values': valid_numeric_values,
                               'test': test,
                               'test_numeric_values': test_numeric_values,
                               'test_topk': test_topk,
                               'test_topk_numeric_values': test_topk_numeric_values,
                               'test_bottomk': test_bottomk,
                               'test_bottomk_numeric_values': test_bottomk_numeric_values}`.
          Each numeric value split contains numeric values associated with the corresponding dataset split and
          is a ndarray of shape (n, 1).
          Each dataset split is a ndarray of shape (n,3).
          The `topk` and `bottomk` splits are only returned when `split_test_into_top_bottom` is set to `True` and contain
          the triples ordered by highest/lowest numeric edge value associated. These are typically used at evaluation time
          aiming at observing a model that assigns the highest rank possible to the `_topk` and the lowest possible to
          the `_bottomk`.
      """
      dataset["train_numeric_values"] = dataset["train"][:, 3:].astype(
          np.float32
      )
      dataset["valid_numeric_values"] = dataset["valid"][:, 3:].astype(
          np.float32
      )
      dataset["test_numeric_values"] = dataset["test"][:, 3:].astype(
          np.float32
      )
  
      dataset["train"] = dataset["train"][:, 0:3]
      dataset["valid"] = dataset["valid"][:, 0:3]
      dataset["test"] = dataset["test"][:, 0:3]
  
      sorted_indices = np.squeeze(
          np.argsort(dataset["test_numeric_values"], axis=0)
      )
      dataset["test"] = dataset["test"][sorted_indices]
      dataset["test_numeric_values"] = dataset["test_numeric_values"][
          sorted_indices
      ]
  
      if split_test_into_top_bottom:
          split_threshold = int(
              split_threshold * dataset["test"].shape[0]
          )
  
          dataset["test_bottomk"] = dataset["test"][:split_threshold]
          dataset["test_bottomk_numeric_values"] = dataset[
              "test_numeric_values"
          ][:split_threshold]
  
          dataset["test_topk"] = dataset["test"][-split_threshold:]
          dataset["test_topk_numeric_values"] = dataset[
              "test_numeric_values"
          ][-split_threshold:]
  
      return dataset
  
imports: import hashlib
  import json
  import logging
  import os
  import urllib
  import zipfile
  from collections import namedtuple
  from pathlib import Path
  import numpy
  import pandas
label_desc: Use image node_id 21 for calling a global function with example usage: generate_focusE_dataset_splits(dataset, split_test_into_top_bottom, split_threshold) and returns: dataset