code: def infer_distribution_test():
      from h2o.utils.distributions import (
          CustomDistributionGeneric,
          CustomDistributionGaussian,
      )
  
      class CustomDistributionGaussian2(CustomDistributionGeneric):
          def link(self):
              return "identity"
  
          def init(self, w, o, y):
              return [w * (y - o), w]
  
          def gradient(self, y, f):
              return y - f
  
          def gamma(self, w, y, z, f):
              return [w * z, w]
  
      custom_dist1 = h2o.upload_custom_distribution(
          CustomDistributionGaussian
      )
      custom_dist2 = h2o.upload_custom_distribution(
          CustomDistributionGaussian2
      )
  
      for dist in [
          "poisson",
          "laplace",
          "tweedie",
          "gaussian",
          "huber",
          "gamma",
          "quantile",
          "bernoulli",
          "quasibinomial",
          "multinomial",
      ]:
          infer_distribution_helper(dist, dist)
  
      # custom distribution
      infer_distribution_helper(
          "custom",
          "custom",
          dict(custom_distribution_func=custom_dist1),
          dict(custom_distribution_func=custom_dist1),
      )
  
      # revert to default
      infer_distribution_helper(
          "tweedie", "gaussian", dict(tweedie_power=1.2)
      )
      infer_distribution_helper(
          "huber", "gaussian", dict(huber_alpha=0.2)
      )
      infer_distribution_helper(
          "quantile", "gaussian", dict(quantile_alpha=0.2)
      )
      infer_distribution_helper(
          "custom",
          "gaussian",
          dict(custom_distribution_func=custom_dist1),
          dict(custom_distribution_func=custom_dist2),
      )
  
      # unaffected by param for different distribution
      infer_distribution_helper(
          "quantile", "quantile", dict(tweedie_power=1.2)
      )
      infer_distribution_helper(
          "tweedie", "tweedie", dict(huber_alpha=0.2)
      )
      infer_distribution_helper(
          "huber", "huber", dict(quantile_alpha=0.2)
      )
      infer_distribution_helper(
          "custom",
          "custom",
          dict(custom_distribution_func=custom_dist1),
          dict(
              custom_distribution_func=custom_dist1, tweedie_power=1.2
          ),
      )
  
file_path: h2o-3/h2o-py/tests/testdir_algos/stackedensemble/pyunit_stackedensemble_distributions.py
imports: import sys
  import h2o
  from h2o.estimators.random_forest import H2ORandomForestEstimator
  from h2o.estimators.glm import H2OGeneralizedLinearEstimator
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
  from h2o.estimators.stackedensemble import H2OStackedEnsembleEstimator
  from h2o.estimators.naive_bayes import H2ONaiveBayesEstimator
  from tests import pyunit_utils
label_desc: Use image node_id 2 for calling a global function with example usage: infer_distribution_test() and returns: str, list, unknown, list