code: def matrix_subset(matrix, n_samples):
      if matrix.shape[0] == 0:
          return matrix
      n_samples = min(matrix.shape[0], n_samples)
      return matrix[
          np.random.choice(matrix.shape[0], n_samples, replace=False)
      ]
  
file_path: anchor/anchor/anchor_base.py
imports: from __future__ import print_function
  import numpy
  import operator
  import copy
  import sklearn
  import collections
label_desc: Use image node_id 1 for calling a global function with example usage: matrix_subset(matrix, n_samples) and returns: matrix, matrix