code: def buildModelCheckStdCoeffs(training_fileName, family):
      training_data = h2o.import_file(
          pyunit_utils.locate(training_fileName)
      )
      ncols = training_data.ncols
      Y = ncols - 1
      x = list(range(0, Y))
      enumCols = Y / 2
      if family == "binomial" or family == "multinomial":
          training_data[Y] = training_data[Y].asfactor()  #
      for ind in range(
          int(enumCols)
      ):  # first half of the columns are enums
          training_data[ind] = training_data[ind].asfactor()
      model1 = H2OGeneralizedLinearEstimator(
          family=family, standardize=True
      )
      model1.train(training_frame=training_data, x=x, y=Y)
      stdCoeff1 = model1.coef_norm()
      modelNS = H2OGeneralizedLinearEstimator(
          family=family, standardize=False
      )
      modelNS.train(training_frame=training_data, x=x, y=Y)
  
      coeffNSStandardized = modelNS.coef_norm()
      coeffNS = modelNS.coef()
      if family == "multinomial":
          nclass = len(coeffNS)
          for cind in range(nclass):
              coeff1PerClass = coeffNSStandardized[
                  "std_coefs_class_" + str(cind)
              ]
              coeff2PerClass = coeffNS["coefs_class_" + str(cind)]
              print(
                  "Comparing multinomial coefficients for class {0}".format(
                      cind
                  )
              )
              assert_coeffs_equal(
                  coeff1PerClass, coeff2PerClass, training_data
              )
      else:  # for binomial and gaussian
          assert_coeffs_equal(
              coeffNSStandardized, coeffNS, training_data
          )
  
      # standardize numerical columns here
      for ind in range(
          int(enumCols), Y
      ):  # change the numerical columns to have mean 0 and std 1
          aver = training_data[ind].mean()
          sigma = 1.0 / math.sqrt(training_data[ind].var())
          training_data[ind] = (training_data[ind] - aver) * sigma
  
      model2 = H2OGeneralizedLinearEstimator(
          family=family, standardize=False
      )
      model2.train(training_frame=training_data, x=x, y=Y)
      coeff2 = model2.coef_norm()
      compare_coeffs_2_model(
          family, stdCoeff1, coeff2
      )  # make sure standardized coefficients from model 1 and 2 are the same
  
      # this part of the test is to check and make sure the changes I made int coef() and coef_norm() accurately
      # capture the correct coefficients.
      coeff2Coef = (
          model2.coef()
      )  # = coeff2 since training data are standardized already
      compare_coeffs_2_model(family, coeff2, coeff2Coef, sameModel=True)
  
file_path: h2o-3/h2o-py/tests/testdir_algos/glm/pyunit_pubdev_7238_standardized_coeff_check.py
imports: from builtins import range
  import sys
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.glm import H2OGeneralizedLinearEstimator
  import math
label_desc: Use image node_id 2 for calling a global function with example usage: buildModelCheckStdCoeffs(training_fileName, family) without return types