code: def train_val_split(X, y, val_ratio=0.2):
      """
      Returns X_train, X_val, y_train, y_val
      """
      if len(X) != len(y):
          raise ValueError("X must be equal to y")
  
      data = []
      for i in range(len(X)):
          data.append([X[i], y[i]])
  
      split = int(len(X) - (len(X) * val_ratio)) - 1
  
      data_train = data[0:split]
      data_val = data[split:]
  
      X_train, y_train = (np.array(item) for item in _sep(data_train))
      X_val, y_val = (np.array(item) for item in _sep(data_val))
  
      del data
      gc.collect()
  
      return X_train, X_val, y_train, y_val
  
file_path: caer/caer/core.py
imports: import cv2
  import numpy
  import gc
  from .path import listdir, join
label_desc: Use image node_id 6 for calling a global function with example usage: train_val_split(X, y, val_ratio) and returns: X_train,  X_val,  y_train,  y_val