code: def generate_data(num_train_samples, len_label, len_feat):
      """Generate synthetic dataset
  
      Generate random data following [1]:
      Each example has exactly one label on.
      Each label has 40 related binary features.
      For an example, if label i is on, 4i randomly chosen features are set to 1
  
      [1] Finley, Thomas, and Thorsten Joachims.
      "Training structural SVMs when exact inference is intractable."
      Proceedings of the 25th international conference on Machine learning. ACM, 2008.
  
      Args:
          num_train_samples: number of samples
          len_label: label length (10)
          len_feat: feature length (40)
  
      Returns:
          feats: generated feature matrix
          labels: generated label matrix
      """
  
      labels = np.zeros((num_train_samples, len_label), np.int32)
      feats = np.zeros((num_train_samples, len_feat), np.int32)
  
      for k in range(num_train_samples):
          i = k % len_label
          labels[k, i] = 1
          inds_one = np.random.permutation(range(len_feat))
          inds_one = inds_one[: 4 * (i + 1)]
          for j in inds_one:
              feats[k, j] = 1
  
      return (labels, feats)
  
file_path: shogun/examples/undocumented/python/structure_graphcuts.py
imports: import numpy
  import itertools
  import shogun
label_desc: Use image node_id 1 for calling a global function with example usage: generate_data(num_train_samples, len_label, len_feat) and returns: labels,  feats