code: def glm_ll_aic():
      cars = h2o.import_file(
          path=pyunit_utils.locate("smalldata/junit/cars_20mpg.csv")
      )
      s = cars[0].runif()
      train = cars[s > 0.2]
      valid = cars[s <= 0.2]
      train_pd = train.as_data_frame(use_pandas=True).dropna()
      train = H2OFrame(train_pd)
      predictors = [
          "displacement",
          "power",
          "weight",
          "acceleration",
          "year",
      ]
      response_col = "economy"
      glm = H2OGeneralizedLinearEstimator(
          calc_like=True, nfolds=3, family="gaussian"
      )
      glm.train(
          x=predictors,
          y=response_col,
          training_frame=train,
          validation_frame=valid,
      )
      ll = glm.loglikelihood(train=True, valid=True)
      aic = glm.aic(train=True, valid=True)
      print(glm.family)
      print(ll)
      print(aic)
  
      glm = H2OGeneralizedLinearEstimator(
          calc_like=True, nfolds=3, family="poisson"
      )
      glm.train(
          x=predictors,
          y=response_col,
          training_frame=train,
          validation_frame=valid,
      )
      ll = glm.loglikelihood(train=True, valid=True)
      aic = glm.aic(train=True, valid=True)
      print(glm.family)
      print(ll)
      print(aic)
  
      glm = H2OGeneralizedLinearEstimator(
          calc_like=True, nfolds=3, family="negativebinomial"
      )
      glm.train(
          x=predictors,
          y=response_col,
          training_frame=train,
          validation_frame=valid,
      )
      ll = glm.loglikelihood(train=True, valid=True)
      aic = glm.aic(train=True, valid=True)
      print(glm.family)
      print(ll)
      print(aic)
  
      glm = H2OGeneralizedLinearEstimator(
          calc_like=True, nfolds=3, family="gamma"
      )
      glm.train(
          x=predictors,
          y=response_col,
          training_frame=train,
          validation_frame=valid,
      )
      ll = glm.loglikelihood(train=True, valid=True)
      aic = glm.aic(train=True, valid=True)
      print(glm.family)
      print(ll)
      print(aic)
  
      glm = H2OGeneralizedLinearEstimator(
          calc_like=True,
          nfolds=3,
          family="tweedie",
          tweedie_variance_power=1.5,
      )
      glm.train(
          x=predictors,
          y=response_col,
          training_frame=train,
          validation_frame=valid,
      )
      ll = glm.loglikelihood(train=True, valid=True)
      aic = glm.aic(train=True, valid=True)
      print(glm.family)
      print(ll)
      print(aic)
  
imports: import sys
  from h2o import H2OFrame
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.glm import H2OGeneralizedLinearEstimator
label_desc: Use image node_id 1 for calling a global function with example usage: glm_ll_aic() without return types