code: def stochasticgbmachine(
      train=traindat, train_labels=label_traindat, ft=feat_types
  ):
      # wrap features and labels into Shogun objects
      feats = sg.create_features(sg.read_csv(train))
      labels = sg.create_labels(sg.read_csv(train_labels))
  
      # divide into training (90%) and test dataset (10%)
      p = np.random.permutation(labels.get_num_labels())
      num = labels.get_num_labels() * 0.9
  
      cart = sg.create_machine("CARTree", nominal=ft, max_depth=1)
      loss = sg.create_loss("SquaredLoss")
      s = sg.create_machine(
          "StochasticGBMachine",
          machine=cart,
          loss=loss,
          num_iterations=500,
          learning_rate=0.01,
      )
  
      # train
      feats.add_subset(np.int32(p[0 : int(num)]))
      labels.add_subset(np.int32(p[0 : int(num)]))
      s.set_labels(labels)
      s.train(feats)
      feats.remove_subset()
      labels.remove_subset()
  
      # apply
      feats.add_subset(np.int32(p[int(num) : len(p)]))
      labels.add_subset(np.int32(p[int(num) : len(p)]))
      output = s.apply_regression(feats)
  
      feats.remove_subset()
      labels.remove_subset()
  
      return s, output
  
label_desc: Use image node_id 1 for calling a global function with example usage: stochasticgbmachine(train, train_labels, ft) and returns: s,  output