code: def test_mean_per_class_error_binomial():
      gbm = H2OGradientBoostingEstimator(
          nfolds=3, fold_assignment="Random", seed=1234
      )
      cars = h2o.import_file(
          pyunit_utils.locate("smalldata/junit/cars_20mpg.csv")
      )
      cars["economy_20mpg"] = cars["economy_20mpg"].asfactor()
      r = cars[0].runif(seed=1234)
      train = cars[r > 0.2]
      valid = cars[r <= 0.2]
      response_col = "economy_20mpg"
      predictors = [
          "displacement",
          "power",
          "weight",
          "acceleration",
          "year",
      ]
      gbm.distribution = "bernoulli"
      gbm.train(
          y=response_col,
          x=predictors,
          validation_frame=valid,
          training_frame=train,
      )
      # print(gbm)
      mpce = gbm.mean_per_class_error(
          [0.5, 0.8]
      )  ## different thresholds
      assert abs(mpce[0][1] - 0.008264) < 1e-5
      assert abs(mpce[1][1] - 0.018716) < 1e-5
  
      ## score on train first
      print(
          gbm.model_performance(train).mean_per_class_error(
              thresholds=[0.3, 0.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 1 for calling a global function with example usage: test_mean_per_class_error_binomial() without return types