code: def test_mean_per_class_error_multinomial():
      gbm = H2OGradientBoostingEstimator(
          nfolds=3, fold_assignment="Random", seed=1234
      )
      cars = h2o.import_file(
          pyunit_utils.locate("smalldata/junit/cars_20mpg.csv")
      )
      cars["cylinders"] = cars["cylinders"].asfactor()
      r = cars[0].runif(seed=1234)
      train = cars[r > 0.2]
      valid = cars[r <= 0.2]
      response_col = "cylinders"
      predictors = [
          "displacement",
          "power",
          "weight",
          "acceleration",
          "year",
      ]
      gbm.distribution = "multinomial"
      gbm.train(
          x=predictors,
          y=response_col,
          training_frame=train,
          validation_frame=valid,
      )
      # print(gbm)
      print(gbm.__class__.__mro__)
      mpce = gbm.mean_per_class_error(train=True)
      assert mpce == 0
      mpce = gbm.mean_per_class_error(valid=True)
      # assert(abs(mpce - 0.207142857143 ) < 1e-5)
      assert abs(mpce - 0.407142857143) < 1e-5
      mpce = gbm.mean_per_class_error(xval=True)
      # assert(abs(mpce - 0.350071715433 ) < 1e-5)
      assert abs(mpce - 0.35127653471) < 1e-5
  
file_path: h2o-3/h2o-py/tests/testdir_misc/pyunit_mean_per_class_error.py
imports: import sys
  import h2o
  import math
  from tests import pyunit_utils
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
  from h2o.grid import H2OGridSearch
label_desc: Use image node_id 2 for calling a global function with example usage: test_mean_per_class_error_multinomial() without return types