code: def structure_multiclass_bmrm(
      fm_train_real=traindat, label_train_multiclass=label_traindat
  ):
      from shogun import MulticlassSOLabels
      from shogun import SOSVMHelper
  
      try:
          from shogun import BMRM, PPBMRM, P3BMRM, DualLibQPBMSOSVM
      except ImportError:
          print(
              "At least one of BMRM, PPBMRM, P3BMRM, DualLibQPBMSOSVM not available"
          )
          exit(0)
      from shogun import MulticlassModel, RealNumber
      import shogun as sg
  
      labels = MulticlassSOLabels(label_train_multiclass)
      features = sg.create_features(fm_train_real.T)
  
      model = MulticlassModel(features, labels)
      sosvm = DualLibQPBMSOSVM(model, labels, 1.0)
  
      # BMRM
      sosvm.set_solver(BMRM)
      sosvm.set_verbose(True)
      sosvm.train()
  
      bmrm_out = sosvm.apply()
      count = 0
      for i in range(bmrm_out.get_num_labels()):
          yi_pred = bmrm_out.get("labels_vector")[i]
          if yi_pred == label_train_multiclass[i]:
              count = count + 1
  
      # print("BMRM: Correct classification rate: %0.2f" % ( 100.0*count/bmrm_out.get_num_labels() ))
      # hp = sosvm.get_helper()
      # print hp.get_primal_values()
      # print hp.get_train_errors()
  
      # PPBMRM
      w = np.zeros(model.get_dim())
      sosvm.set_w(w)
      sosvm.set_solver(PPBMRM)
      sosvm.set_verbose(True)
      sosvm.train()
  
      ppbmrm_out = sosvm.apply()
      count = 0
      for i in range(ppbmrm_out.get_num_labels()):
          yi_pred = ppbmrm_out.get("labels_vector")[i]
          if yi_pred == label_train_multiclass[i]:
              count = count + 1
  
      # print("PPBMRM: Correct classification rate: %0.2f" % ( 100.0*count/ppbmrm_out.get_num_labels() ))
  
      # P3BMRM
      w = np.zeros(model.get_dim())
      sosvm.set_w(w)
      sosvm.set_solver(P3BMRM)
      sosvm.set_verbose(True)
      sosvm.train()
  
      p3bmrm_out = sosvm.apply()
      count = 0
      for i in range(p3bmrm_out.get_num_labels()):
          yi_pred = p3bmrm_out.get("labels_vector")[i]
          if yi_pred == label_train_multiclass[i]:
              count = count + 1
  
      # print("P3BMRM: Correct classification rate: %0.2f" % ( 100.0*count/p3bmrm_out.get_num_labels() ))
      return bmrm_out, ppbmrm_out, p3bmrm_out
  
label_desc: Use image node_id 2 for calling a global function with example usage: structure_multiclass_bmrm(fm_train_real, label_train_multiclass) and returns: bmrm_out,  ppbmrm_out,  p3bmrm_out