code: def random_split(
      interactions: BaseInteractions,
      val_p: float = 0.0,
      test_p: float = 0.2,
      processes: Optional[Any] = None,
      seed: Optional[int] = None,
  ) -> Tuple[BaseInteractions, ...]:
      """
      Randomly split interactions into training, validation, and testing sets.
  
      This split does NOT guarantee that every user will be represented in both the training and
      testing datasets. While much faster than ``stratified_split``, it is not the most representative
      data split because of this.
  
      Note that this function is not supported for ``HDF5Interactions`` objects, since this data split
      implementation requires all data to fit in memory. A data split for large datasets should be
      done using a big data processing technology, like Spark.
  
      Parameters
      ----------
      interactions: collie.interactions.BaseInteractions
      val_p: float
          Proportion of data used for validation
      test_p: float
          Proportion of data used for testing
      processes: Any
          Ignored, included only for compatability with ``stratified_split`` API
      seed: int
          Random seed for splits
  
      Returns
      -------
      train_interactions: collie.interactions.BaseInteractions
          Training data of size proportional to ``1 - val_p - test_p``
      validate_interactions: collie.interactions.BaseInteractions
          Validation data of size proportional to ``val_p``, returned only if ``val_p > 0``
      test_interactions: collie.interactions.BaseInteractions
          Testing data of size proportional to ``test_p``
  
      Examples
      --------
      .. code-block:: python
  
          >>> interactions = Interactions(...)
          >>> len(interactions)
          100000
          >>> train, test = random_split(interactions)
          >>> len(train), len(test)
          (80000, 20000)
  
      """
      assert not isinstance(
          interactions, HDF5Interactions
      ), "``HDF5Interactions`` data type not supported in cross validation splits!"
  
      _validate_val_p_and_test_p(val_p=val_p, test_p=test_p)
  
      if seed is None:
          seed = get_random_seed()
  
      np.random.seed(seed)
  
      shuffle_indices = np.arange(len(interactions))
      np.random.shuffle(shuffle_indices)
  
      interactions = _subset_interactions(
          interactions=interactions, idxs=shuffle_indices
      )
  
      validate_and_test_p = val_p + test_p
      validate_cutoff = int(
          (1.0 - validate_and_test_p) * len(interactions)
      )
      test_cutoff = int((1.0 - test_p) * len(interactions))
  
      train_idxs = np.arange(validate_cutoff)
      validate_idxs = np.arange(validate_cutoff, test_cutoff)
      test_idxs = np.arange(test_cutoff, len(interactions))
  
      train_interactions = _subset_interactions(
          interactions=interactions, idxs=train_idxs
      )
      test_interactions = _subset_interactions(
          interactions=interactions, idxs=test_idxs
      )
  
      if val_p > 0:
          validate_interactions = _subset_interactions(
              interactions=interactions, idxs=validate_idxs
          )
  
          return (
              train_interactions,
              validate_interactions,
              test_interactions,
          )
      else:
          return train_interactions, test_interactions
  
file_path: collie/collie/cross_validation.py
imports: from collections import defaultdict
  import functools
  import operator
  from typing import Any, Iterable, Optional, Tuple, Union
  from joblib import delayed, Parallel
  import numpy
  from scipy.sparse import coo_matrix
  from sklearn.model_selection import train_test_split
  from collie.interactions import BaseInteractions, ExplicitInteractions, HDF5Interactions, Interactions
  from collie.utils import get_random_seed
label_desc: Use image node_id 2 for calling a global function with example usage: random_split(interactions, val_p, test_p, processes, seed) and returns: train_interactions,  validate_interactions,  test_interactions, train_interactions,  test_interactions