code: def class_extensions():
      def get_regression_influence_diagnostics(self):
          """
          For GLM model, if influence is set to dfbetas, a frame containing the original predictors, response
          and DFBETA_ for each predictors that are used in building the model is returned.
  
          :return: H2OFrame containing predictors used in building the model, response and DFBETA_ for each predictor.
  
          :examples:
          >>> d = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
          >>> m = H2OGeneralizedLinearEstimator(family = 'binomial',
          ...                                   lambda_=0.0,
          ...                                   standardize=False,
          ...                                   influence="dfbetas")
          >>> m.train(training_frame = d,
          ...         x = [2,3,4,5,6,7,8],
          ...         y = 1)
          >>> ridFrame = m.get_regression_influence_diagnostics()
          >>> print("column names of regression influence diagnostics frame is {0}".format(ridFrame.names))
          """
  
          if self.actual_params["influence"] == "dfbetas":
              return h2o.get_frame(
                  self._model_json["output"][
                      "regression_influence_diagnostics"
                  ]["name"]
              )
          else:
              raise H2OValueError(
                  "get_regression_influence_diagnostics can only be called if influence='dfbetas'."
              )
  
      @staticmethod
      def getAlphaBest(model):
          """
          Extract best alpha value found from glm model.
  
          :param model: source lambda search model
  
          :examples:
  
          >>> d = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
          >>> m = H2OGeneralizedLinearEstimator(family = 'binomial',
          ...                                   lambda_search = True,
          ...                                   solver = 'COORDINATE_DESCENT')
          >>> m.train(training_frame = d,
          ...         x = [2,3,4,5,6,7,8],
          ...         y = 1)
          >>> bestAlpha = H2OGeneralizedLinearEstimator.getAlphaBest(m)
          >>> print("Best alpha found is {0}".format(bestAlpha))
          """
          return model._model_json["output"]["alpha_best"]
  
      @staticmethod
      def getLambdaBest(model):
          """
          Extract best lambda value found from glm model.
  
          :param model: source lambda search model
  
          :examples:
  
          >>> d = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
          >>> m = H2OGeneralizedLinearEstimator(family = 'binomial',
          ...                                   lambda_search = True,
          ...                                   solver = 'COORDINATE_DESCENT')
          >>> m.train(training_frame = d,
          ...         x = [2,3,4,5,6,7,8],
          ...         y = 1)
          >>> bestLambda = H2OGeneralizedLinearEstimator.getLambdaBest(m)
          >>> print("Best lambda found is {0}".format(bestLambda))
          """
          return model._model_json["output"]["lambda_best"]
  
      @staticmethod
      def getLambdaMax(model):
          """
          Extract the maximum lambda value used during lambda search.
  
          :param model: source lambda search model
  
          :examples:
  
          >>> d = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
          >>> m = H2OGeneralizedLinearEstimator(family = 'binomial',
          ...                                   lambda_search = True,
          ...                                   solver = 'COORDINATE_DESCENT')
          >>> m.train(training_frame = d,
          ...         x = [2,3,4,5,6,7,8],
          ...         y = 1)
          >>> maxLambda = H2OGeneralizedLinearEstimator.getLambdaMax(m)
          >>> print("Maximum lambda found is {0}".format(maxLambda))
          """
          lambdaMax = model._model_json["output"][
              "lambda_max"
          ]  # will be -1 if lambda_search is disabled
          if lambdaMax >= 0:
              return lambdaMax
          else:
              raise H2OValueError(
                  "getLambdaMax(model) can only be called when lambda_search=True."
              )
  
      @staticmethod
      def getLambdaMin(model):
          """
          Extract the minimum lambda value calculated during lambda search from glm model.  Note that due to early stop,
          this minimum lambda value may not be used in the actual lambda search.
  
          :param model: source lambda search model
  
          :examples:
  
          >>> d = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
          >>> m = H2OGeneralizedLinearEstimator(family = 'binomial',
          ...                                   lambda_search = True,
          ...                                   solver = 'COORDINATE_DESCENT')
          >>> m.train(training_frame = d,
          ...         x = [2,3,4,5,6,7,8],
          ...         y = 1)
          >>> minLambda = H2OGeneralizedLinearEstimator.getLambdaMin(m)
          >>> print("Minimum lambda found is {0}".format(minLambda))
          """
          lambdaMin = model._model_json["output"][
              "lambda_min"
          ]  # will be -1 if lambda_search is disabled
          if lambdaMin >= 0:
              return lambdaMin
          else:
              raise H2OValueError(
                  "getLambdaMin(model) can only be called when lambda_search=True."
              )
  
      @staticmethod
      def getGLMRegularizationPath(model):
          """
          Extract full regularization path explored during lambda search from glm model.
  
          :param model: source lambda search model
  
          :examples:
  
          >>> d = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
          >>> m = H2OGeneralizedLinearEstimator(family = 'binomial',
          ...                                   lambda_search = True,
          ...                                   solver = 'COORDINATE_DESCENT')
          >>> m.train(training_frame = d,
          ...         x = [2,3,4,5,6,7,8],
          ...         y = 1)
          >>> r = H2OGeneralizedLinearEstimator.getGLMRegularizationPath(m)
          >>> m2 = H2OGeneralizedLinearEstimator.makeGLMModel(model=m,
          ...                                                 coefs=r['coefficients'][10])
          >>> dev1 = r['explained_deviance_train'][10]
          >>> p = m2.model_performance(d)
          >>> dev2 = 1-p.residual_deviance()/p.null_deviance()
          >>> print(dev1, " =?= ", dev2)
          """
          x = h2o.api(
              "GET /3/GetGLMRegPath",
              data={"model": model._model_json["model_id"]["name"]},
          )
          ns = x.pop("coefficient_names")
          res = {
              "lambdas": x["lambdas"],
              "alphas": x["alphas"],
              "explained_deviance_train": x["explained_deviance_train"],
              "explained_deviance_valid": x["explained_deviance_valid"],
              "coefficients": [
                  dict(zip(ns, y)) for y in x["coefficients"]
              ],
              "z_values": None
              if (x["z_values"] is None)
              else [dict(zip(ns, z)) for z in x["z_values"]],
              "p_values": None
              if (x["p_values"] is None)
              else [dict(zip(ns, p)) for p in x["p_values"]],
              "std_errs": None
              if (x["std_errs"] is None)
              else [dict(zip(ns, s)) for s in x["std_errs"]],
              "names": ns,
          }
          if "coefficients_std" in x and not (
              x["coefficients_std"] == None
          ):
              res["coefficients_std"] = [
                  dict(zip(ns, y)) for y in x["coefficients_std"]
              ]
          return res
  
      @staticmethod
      def makeGLMModel(model, coefs, threshold=0.5):
          """
          Create a custom GLM model using the given coefficients.
  
          Needs to be passed source model trained on the dataset to extract the dataset information from.
  
          :param model: source model, used for extracting dataset information
          :param coefs: dictionary containing model coefficients
          :param threshold: (optional, only for binomial) decision threshold used for classification
  
          :examples:
  
          >>> d = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
          >>> m = H2OGeneralizedLinearEstimator(family='binomial',
          ...                                   lambda_search=True,
          ...                                   solver='COORDINATE_DESCENT')
          >>> m.train(training_frame=d,
          ...         x=[2,3,4,5,6,7,8],
          ...         y=1)
          >>> r = H2OGeneralizedLinearEstimator.getGLMRegularizationPath(m)
          >>> m2 = H2OGeneralizedLinearEstimator.makeGLMModel(model=m,
          ...                                                 coefs=r['coefficients'][10])
          >>> dev1 = r['explained_deviance_train'][10]
          >>> p = m2.model_performance(d)
          >>> dev2 = 1-p.residual_deviance()/p.null_deviance()
          >>> print(dev1, " =?= ", dev2)
          """
          model_json = h2o.api(
              "POST /3/MakeGLMModel",
              data={
                  "model": model._model_json["model_id"]["name"],
                  "names": list(coefs.keys()),
                  "beta": list(coefs.values()),
                  "threshold": threshold,
              },
          )
          m = H2OGeneralizedLinearEstimator()
          m._resolve_model(model_json["model_id"]["name"], model_json)
          return m
  
label_desc: Use image node_id 2 for calling a global function with example usage: class_extensions() and returns: model, model, res, m, h2o, lambdaMax, lambdaMin