class_docstr: The RidgeRegression class is used to fit ridge models against one or more labels optimized over a provided list of
  ridge alpha parameters.  It is similar in function to RidgeReduction except that whereas RidgeReduction attempts to
  reduce a starting matrix X to a block matrix of smaller dimension, RidgeRegression is intended to find an optimal
  model of the form Y_hat ~ XB, where Y_hat is a matrix of one or more predicted labels and B is a matrix of
  coefficients.  The optimal ridge alpha value is chosen for each label by maximizing the average out of fold r2
  score.
class_docstr_tok: ["The","RidgeRegression","class","is","used","to","fit","ridge","models","against","one","or","more","labels","optimized","over","a","provided","list","of","ridge","alpha","parameters",".","It","is","similar","in","function","to","RidgeReduction","except","that","whereas","RidgeReduction","attempts","to","reduce","a","starting","matrix","X","to","a","block","matrix","of","smaller","dimension",",","RidgeRegression","is","intended","to","find","an","optimal","model","of","the","form","Y_hat","~","XB",",","where","Y_hat","is","a","matrix","of","one","or","more","predicted","labels","and","B","is","a","matrix","of","coefficients",".","The","optimal","ridge","alpha","value","is","chosen","for","each","label","by","maximizing","the","average","out","of","fold","r2","score","."]
docstr: Generates predictions for the target labels in the provided label DataFrame by applying the model resulting from
  the RidgeRegression fit method to the reduced block matrix.
  
  Returns:
      Pandas DataFrame containing prediction y_hat values. The shape and order match label_df such that the
      rows are indexed by sample ID and the columns by label. The column types are float64.
docstr_tok: ["Generates","predictions","for","the","target","labels","in","the","provided","label","DataFrame","by","applying","the","model","resulting","from","the","RidgeRegression","fit","method","to","the","reduced","block","matrix",".","Returns",":","Pandas","DataFrame","containing","prediction","y_hat","values",".","The","shape","and","order","match","label_df","such","that","the","rows","are","indexed","by","sample","ID","and","the","columns","by","label",".","The","column","types","are","float64","."]
code: def transform(self) -> pd.DataFrame:
      """
      Generates predictions for the target labels in the provided label DataFrame by applying the model resulting from
      the RidgeRegression fit method to the reduced block matrix.
  
      Returns:
          Pandas DataFrame containing prediction y_hat values. The shape and order match label_df such that the
          rows are indexed by sample ID and the columns by label. The column types are float64.
      """
      _check_model(self.model_df)
      _check_cv(self.cv_df)
  
      transform_key_pattern = ["sample_block", "label"]
  
      transform_udf = pandas_udf(
          lambda key, pdf: apply_model(
              key,
              transform_key_pattern,
              pdf,
              self._std_label_df,
              self.sample_blocks,
              self._alphas,
              self._std_cov_df,
          ),
          reduced_matrix_struct,
          PandasUDFType.GROUPED_MAP,
      )
  
      blocked_prediction_df = apply_model_df(
          self.reduced_block_df,
          self.model_df,
          self.cv_df,
          transform_udf,
          transform_key_pattern,
          "right",
      )
  
      self.y_hat_df = flatten_prediction_df(
          blocked_prediction_df, self.sample_blocks, self._std_label_df
      )
  
      record_hls_event("wgrRidgeRegressionTransform")
  
      return self.y_hat_df
  
imports: from .ridge_udfs import *
  from .ridge_reduction import RidgeReduction
  from .model_functions import _prepare_labels_and_warn, _prepare_covariates, _check_model, _check_cv
  from nptyping import Float, NDArray
  import pandas
  from pyspark.sql import DataFrame, Row
  from pyspark.sql.functions import pandas_udf, PandasUDFType
  import pyspark.sql.functions
  from typeguard import typechecked
  from typing import Any, Dict, List, Union
  from glow.logging import record_hls_event
  import warnings
label_desc: Use image node_id 13 for calling the RidgeRegression obj's underlying member method code with example usage: obj.transform() and returns: self