dot-build_tuning_env: Build Tuning Environment

.build_tuning_envR Documentation

Build Tuning Environment

Description

Assembles a named list containing all pre-computed objects and configuration needed by the tuning-objective evaluation and gradient functions during penalty tuning. This avoids deep nesting of closures and makes the dependencies explicit.

Usage

.build_tuning_env(
  y,
  X,
  X_gram,
  Xy,
  smoothing_spline_penalty,
  A,
  R_constraints,
  K,
  p_expansions,
  N_obs,
  custom_penalty_mat,
  colnm_expansions,
  unique_penalty_per_predictor,
  unique_penalty_per_partition,
  meta_penalty,
  family,
  delta,
  order_list,
  observation_weights,
  homogenous_weights,
  parallel,
  parallel_eigen,
  parallel_trace,
  parallel_aga,
  parallel_matmult,
  parallel_qr = FALSE,
  qr_pivot_smoothing_constraints = TRUE,
  parallel_unconstrained,
  cl,
  chunk_size,
  num_chunks,
  rem_chunks,
  unconstrained_fit_fxn,
  keep_weighted_Lambda,
  iterate,
  qp_score_function,
  quadprog,
  qp_Amat,
  qp_bvec,
  qp_meq,
  tol,
  sd_y,
  tuning_criterion,
  gcv_gamma,
  constraint_value_vectors,
  glm_weight_function,
  schur_correction_function,
  need_dispersion_for_estimation,
  dispersion_function,
  blockfit,
  just_linear_without_interactions,
  Vhalf,
  VhalfInv,
  verbose,
  include_warnings,
  flat_cols,
  use_blockfit
)

Arguments

gcv_gamma

Numeric scalar, at least 1; modified-GCV multiplier for the effective-degrees-of-freedom term.

flat_cols

Integer vector; pre-computed flat column indices (passed in from tune_Lambda to avoid recomputation).

use_blockfit

Logical; pre-computed dispatch flag (passed in from tune_Lambda).

Details

In addition to the standard tuning arguments, the environment stores two pre-computed blockfit dispatch items:

use_blockfit

Logical; TRUE when blockfit is enabled, flat_cols is non-empty, and K > 0. Mirrors the dispatch logic in lgspline.fit so that the same fitting path is used during tuning as during the final fit.

flat_cols

Integer vector; column indices of non-interactive linear terms derived from just_linear_without_interactions and colnm_expansions. Pre-computed once here rather than re-derived at every tuning-objective evaluation.

Value

Named list (the "tuning environment").


lgspline documentation built on May 8, 2026, 5:07 p.m.