class_docstr: The RidgeReduction class is intended to reduce the feature space of an N by M block matrix X to an N by P<<M block
  matrix.  This is done by fitting K ridge models within each block of X on one or more target labels, such that a
  block with L columns to begin with will be reduced to a block with K columns, where each column is the prediction
  of one ridge model for one target label.
class_docstr_tok: ["The","RidgeReduction","class","is","intended","to","reduce","the","feature","space","of","an","N","by","M","block","matrix","X","to","an","N","by","P","<","<","M","block","matrix",".","This","is","done","by","fitting","K","ridge","models","within","each","block","of","X","on","one","or","more","target","labels",",","such","that","a","block","with","L","columns","to","begin","with","will","be","reduced","to","a","block","with","K","columns",",","where","each","column","is","the","prediction","of","one","ridge","model","for","one","target","label","."]
docstr: Transforms a starting block matrix to the reduced block matrix, using a reducer model produced by the
  RidgeReduction fit method.
  
  Returns:
       Spark DataFrame representing the reduced block matrix
docstr_tok: ["Transforms","a","starting","block","matrix","to","the","reduced","block","matrix",",","using","a","reducer","model","produced","by","the","RidgeReduction","fit","method",".","Returns",":","Spark","DataFrame","representing","the","reduced","block","matrix"]
code: def transform(self) -> DataFrame:
      """
      Transforms a starting block matrix to the reduced block matrix, using a reducer model produced by the
      RidgeReduction fit method.
  
      Returns:
           Spark DataFrame representing the reduced block matrix
      """
      _check_model(self.model_df)
  
      transform_key_pattern = ["header_block", "sample_block"]
  
      if "label" in self.block_df.columns:
          transform_key_pattern.append("label")
          joined = (
              self.block_df.drop("sort_key")
              .join(
                  self.model_df,
                  ["header_block", "sample_block", "header"],
                  "right",
              )
              .withColumn(
                  "label",
                  f.coalesce(
                      f.col("label"), f.col("labels").getItem(0)
                  ),
              )
          )
      else:
          joined = self.block_df.drop("sort_key").join(
              self.model_df,
              ["header_block", "sample_block", "header"],
              "right",
          )
  
      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,
      )
  
      record_hls_event("wgrRidgeReduceTransform")
  
      self.reduced_block_df = joined.groupBy(
          transform_key_pattern
      ).apply(transform_udf)
  
      return self.reduced_block_df
  
imports: from .ridge_udfs import *
  from .model_functions import _is_binary, _prepare_covariates, _prepare_labels_and_warn, _check_model
  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 RidgeReduction obj's underlying member method code with example usage: obj.transform() and returns: self