code: def estimate_loco_offsets(
      block_df: DataFrame,
      label_df: pd.DataFrame,
      sample_blocks: Dict[str, List[str]],
      cov_df: pd.DataFrame = pd.DataFrame({}),
      add_intercept: bool = True,
      reduction_alphas: List[float] = [],
      regression_alphas: List[float] = [],
      label_type="detect",
      chromosomes: List[str] = [],
  ) -> pd.DataFrame:
      """
      The one-stop function to generate WGR predictors to be used as offsets in gwas functions. Given the
      input the function performs the ridge reduction followed by appropriate choice of ridge regression or
      logistic ridge regression in a loco manner.
  
      Args:
          block_df : Spark DataFrame representing the beginning block matrix X
          label_df : Pandas DataFrame containing the target labels used in fitting the ridge models
          sample_blocks : Dict containing a mapping of sample_block ID to a list of corresponding sample IDs
          cov_df : Pandas DataFrame containing covariates to be included in every model in the stacking
              ensemble (optional).
          add_intercept: If True, an intercept column (all ones) will be added to the covariates
              (as the first column)
          reduction_alphas : array_like of alpha values used in the ridge reduction (optional). If not provided, the
              automatically generates alphas for reduction.
          regression_alphas : array_like of alpha values used in the ridge or logistic ridge regression (optional).
              If not provided, the automatically generates alphas for regression.
          label_type: String to determine type treatment of labels. It can be 'detect' (default), 'binary',
              or 'quantitative'. On 'detect' the function picks binary or quantitative based on whether label_df is all
              binary or not, respectively.
          chromosomes : List of chromosomes for which to generate offsets (optional). If not provided, the
                  chromosomes will be inferred from the block matrix.
  
      Returns:
          Pandas DataFrame containing offset values per chromosome. The rows are indexed by sample ID and
          chromosome; the columns are indexed by label. The column types are float64. The DataFrame is sorted using
          chromosome as the primary sort key, and sample ID as the secondary sort key.
      """
      ridge_reduced = RidgeReduction(
          block_df,
          label_df,
          sample_blocks,
          cov_df,
          add_intercept,
          reduction_alphas,
          label_type,
      )
  
      ridge_reduced.fit_transform().cache()
      if ridge_reduced.is_binary():
          regression = LogisticRidgeRegression.from_ridge_reduction(
              ridge_reduced, regression_alphas
          )
          return regression.fit_transform_loco("linear", chromosomes)
      else:
          regression = RidgeRegression.from_ridge_reduction(
              ridge_reduced, regression_alphas
          )
          return regression.fit_transform_loco(chromosomes)
  
file_path: glow/python/glow/wgr/wgr_functions.py
imports: from glow import glow
  import pandas
  import numpy
  from pyspark import SparkContext
  from pyspark.sql import DataFrame, Row, SparkSession, SQLContext
  from typeguard import check_argument_types, check_return_type
  from typing import Any, Dict, List
  from nptyping import Float, NDArray
  from .ridge_reduction import RidgeReduction
  from .ridge_regression import RidgeRegression
  from .logistic_ridge_regression import LogisticRidgeRegression
label_desc: Use image node_id 7 for calling a global function with example usage: estimate_loco_offsets(block_df, label_df, sample_blocks, cov_df, add_intercept, reduction_alphas, regression_alphas, label_type, chromosomes) and returns: regression, regression