Skip to contents

Reuses the \(A\) operator from fit.ssrhe.hessian.l1.regression to fit a new response or a new lambda grid without rebuilding local neighborhoods or local PCA Hessian rows.

Usage

# S3 method for class 'ssrhe.hessian.l1.fit'
refit(
  object,
  y = NULL,
  lambda.grid = object$lambda,
  lambda.selection = c("fixed", "cv"),
  weights = NULL,
  n.lambda = 40L,
  nfolds = 5L,
  fold.id = NULL,
  loss = c("mse", "mae"),
  selection = c("min", "one.se"),
  solver = c("genlasso", "admm", "auto"),
  row.scaling = c("none", "l2"),
  admm.rho = NULL,
  admm.maxiter = 2000L,
  admm.abstol = 1e-06,
  admm.reltol = 1e-05,
  maxsteps = 2000L,
  minlam = 0,
  approx = FALSE,
  rtol = 1e-07,
  btol = 1e-07,
  eps = 1e-04,
  verbose = FALSE,
  admm.adaptive.rho = TRUE,
  ...
)

Arguments

object

A "ssrhe.hessian.l1.fit" object.

y

Optional new numeric response vector. If NULL, the original response is reused.

lambda.grid

Optional nonnegative lambda grid. For lambda.selection = "fixed", this must contain exactly one value. For lambda.selection = "cv", NULL builds a default grid from the fitted full-data generalized-lasso path.

lambda.selection

"cv" for observed-label K-fold cross-validation or "fixed" for a supplied fixed lambda.

weights

Optional nonnegative observation weights. Missing responses automatically receive zero weight.

n.lambda

Number of default lambda candidates when lambda.grid = NULL and lambda.selection = "cv".

nfolds

Number of validation folds over observed positive-weight labels. Ignored when fold.id is supplied.

fold.id

Optional integer fold assignments of length nrow(X).

loss

Validation loss, currently "mse" or "mae".

selection

Selection rule. "min" chooses the smallest mean validation loss. "one.se" chooses the largest lambda within one standard error of the minimum.

solver

Solver backend. "genlasso" uses the generalized-lasso path to propose a grid when needed, then refines every candidate with ADMM on the original objective. "admm" skips the path and requires an explicit grid. "auto" also proceeds when path construction fails, provided an explicit grid is supplied.

row.scaling

Optional row scaling for the penalty matrix before solving. "l2" scales nonzero rows of \(A\) to unit Euclidean norm.

admm.rho, admm.maxiter, admm.abstol, admm.reltol

ADMM controls used by all backends, including refinement of generalized-lasso candidates. admm.rho = NULL chooses an initial algorithm penalty of 1 / max(1, mean(rowSums(D^2))), where D is the penalty operator after any requested row scaling. A positive numeric value sets the initial penalty explicitly. This is separate from statistical regularization lambda.grid. The iteration limit is a hard cap.

maxsteps, minlam, approx, rtol, btol, eps, verbose

Controls passed to genlasso.

admm.adaptive.rho

Logical; adapt the algorithm penalty during the first 1000 iterations by balancing tolerance-normalized primal and dual residuals. Set FALSE to hold the initial penalty fixed.

...

Additional arguments are not currently supported.

Value

A list of class "ssrhe.hessian.l1.refit".

See also

refit for supported fitted objects and migration.

Examples

X <- matrix(seq(0, 1, length.out = 12), ncol = 1)
fit <- fit.ssrhe.hessian.l1.regression(
  X, X[, 1]^2, k = 6L, tangent.dim = 1L,
  lambda.grid = 0.05, lambda.selection = "fixed", solver = "admm"
)
refit(
  fit, y = X[, 1]^3, solver = "admm"
)
#> SSRHE Hessian L1 regression fit
#>   solver: admm 
#>   status: converged  
#>   responses: 1 
#>   lambda.selection: fixed 
#>   lambda: 0.05 
#>   objective: 0.1058