code: def adaptive_model_average(X, penalization, method):
      """Run ModelAverage in default mode (QuicGraphicalLassoCV) to obtain proportion
      matrix.
  
      NOTE:  Only method = 'binary' really makes sense in this case.
      """
      n_trials = 100
      print("Adaptive ModelAverage with:")
      print("   estimator: QuicGraphicalLasso (default)")
      print("   n_trials: {}".format(n_trials))
      print("   penalization: {}".format(penalization))
      print("   adaptive-method: {}".format(method))
  
      # if penalization is random, first find a decent scalar lam_ to build
      # random perturbation matrix around. lam doesn't matter for fully-random.
      lam = 0.5
      if penalization == "random":
          cv_model = QuicGraphicalLassoCV(
              cv=2,
              n_refinements=6,
              sc=spark.sparkContext,  # NOQA
              init_method="cov",
              score_metric=metric,
          )
          cv_model.fit(X)
          lam = cv_model.lam_
          print("   lam: {}".format(lam))
  
      model = AdaptiveGraphicalLasso(
          estimator=ModelAverage(
              n_trials=n_trials,
              penalization=penalization,
              lam=lam,
              sc=spark.sparkContext,
          ),  # NOQA
          method=method,
      )
      model.fit(X)
      lam_norm_ = np.linalg.norm(model.estimator_.lam_)
      print("   ||lam_||_2: {}".format(lam_norm_))
      return (
          model.estimator_.covariance_,
          model.estimator_.precision_,
          lam_norm_,
      )
  
file_path: skggm/examples/estimator_suite_spark.py
imports: import sys
  import numpy
  import tabulate
  import time
  import matplotlib.pyplot
  from sklearn.covariance import ledoit_wolf
  from inverse_covariance import QuicGraphicalLasso, QuicGraphicalLassoCV, QuicGraphicalLassoEBIC, AdaptiveGraphicalLasso, ModelAverage
  from inverse_covariance.profiling import LatticeGraph
label_desc: Use image node_id 7 for calling a global function with example usage: adaptive_model_average(X, penalization, method) and returns: model,  model,  lam_norm_