code: def multilabel_stratified_subsets_sampling(y, n_samples=10):
      """Provides stratified sampling for multi-label data using the subsets sampling
      approach [STV11]_.
  
      Parameters
      ----------
      y : scipy.sparse.csr_matrix
          List of labels.
      n_samples : int, default=10
          Number of indices to sample.
  
      Returns
      -------
      indices : numpy.ndarray
          Indices of the stratified subset.
  
      References
      ----------
      .. [STV11] Konstantinos Sechidis, Grigorios Tsoumakas, and Ioannis Vlahavas.
         On the stratification of multi-label data.
         In: Proceedings of the 2011 European Conference on Machine Learning and Knowledge Discovery
            in Databases - Volume Part III (ECML PKDD'11).
         Springer-Verlag, Berlin, Heidelberg, 145--158.
      """
      y = y.toarray()
      y = np.apply_along_axis(np.array2string, 1, y)
  
      le = LabelEncoder()
      y_labelsets = le.fit_transform(y)
  
      return stratified_sampling(y_labelsets, n_samples=n_samples)
  
file_path: small-text/small_text/data/sampling.py
imports: import numpy
  from scipy.sparse import csr_matrix
  from sklearn.preprocessing import LabelEncoder
label_desc: Use image node_id 1 for calling a global function with example usage: multilabel_stratified_subsets_sampling(y, n_samples) and returns: stratified_sampling