code: def test_ridge_reducer_transform(spark):
      indexdf = spark.read.parquet(
          f"{data_root}/groupedIDs.snappy.parquet"
      )
      blockdf = spark.read.parquet(
          f"{data_root}/blockedGT.snappy.parquet"
      )
      sample_blocks = __get_sample_blocks(indexdf)
      testGroup = "0"
      testBlock = "chr_1_block_0"
      ids = (
          indexdf.filter(f"sample_block = {testGroup}")
          .select("sample_ids")
          .head()
          .sample_ids
      )
      headers = [
          r.header
          for r in blockdf.filter(
              f'header_block = "{testBlock}" AND sample_block = {testGroup}'
          )
          .orderBy("sort_key")
          .select("header")
          .collect()
      ]
  
      X_in = X0[headers].loc[ids, :]
      X_out = X0[headers].drop(ids, axis="rows")
      Y_out = std_labeldf.drop(ids, axis="rows")
  
      XtX_out = X_out.to_numpy().T @ X_out.to_numpy()
      XtY_out = X_out.to_numpy().T @ Y_out.to_numpy()
      B = np.column_stack(
          [
              (
                  np.linalg.inv(
                      XtX_out + np.identity(XtX_out.shape[1]) * a
                  )
                  @ XtY_out
              )
              for a in alphas
          ]
      )
      X1_in = X_in.to_numpy() @ B
  
      stack = RidgeReduction(
          blockdf,
          labeldf,
          sample_blocks,
          add_intercept=False,
          alphas=alphas,
      )
      level1df = stack.fit_transform()
  
      columns = ["values"]
      rows = (
          level1df.filter(
              f'header LIKE "%{testBlock}%" AND sample_block = {testGroup}'
          )
          .select(*columns)
          .collect()
      )
      outdf = pd.DataFrame(rows, columns=columns)
      X1_in_stack = np.column_stack(outdf["values"])
  
      assert np.allclose(X1_in_stack, X1_in)
  
imports: from glow.wgr.ridge_reduction import *
  from glow.wgr.ridge_regression import *
  from glow.wgr.ridge_udfs import *
  from glow.wgr.model_functions import _fill_na_and_standardize
  import numpy
  import pandas
  from pyspark.sql.functions import *
  import math
label_desc: Use image node_id 8 for calling a global function with example usage: test_ridge_reducer_transform(spark) without return types