code: def get_random_subsets(X, y, n_subsets, replacements=True):
      """Return random subsets (with replacements) of the data"""
      n_samples = np.shape(X)[0]
      # Concatenate x and y and do a random shuffle
      X_y = np.concatenate((X, y.reshape((1, len(y))).T), axis=1)
      np.random.shuffle(X_y)
      subsets = []
  
      # Uses 50% of training samples without replacements
      subsample_size = int(n_samples // 2)
      if replacements:
          subsample_size = n_samples  # 100% with replacements
  
      for _ in range(n_subsets):
          idx = np.random.choice(
              range(n_samples),
              size=np.shape(range(subsample_size)),
              replace=replacements,
          )
          X = X_y[idx][:, :-1]
          y = X_y[idx][:, -1]
          subsets.append([X, y])
      return subsets
  
file_path: ML-From-Scratch/mlfromscratch/utils/data_manipulation.py
imports: from __future__ import division
  from itertools import combinations_with_replacement
  import numpy
  import math
  import sys
label_desc: Use image node_id 5 for calling a global function with example usage: get_random_subsets(X, y, n_subsets, replacements) and returns: subsets