% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ecca.r
\name{ecca.cv}
\alias{ecca.cv}
\title{Cross-Validated Efficient CCA}
\usage{
ecca.cv(
  X,
  Y,
  lambdas = 0,
  groups = NULL,
  r = 2,
  standardize = FALSE,
  rho = 1,
  B0 = NULL,
  nfold = 5,
  select = "lambda.min",
  eps = 0.001,
  maxiter = 1000,
  verbose = FALSE,
  maxiter_cv = 300,
  parallel = FALSE,
  nb_cores = NULL,
  set_seed_cv = NULL,
  scoring_method = c("mse", "trace"),
  cv_use_median = FALSE,
  dense = TRUE,
  optimized = FALSE,
  epsilon_sv = 1e-08,
  ridge_whiten = 1e-08
)
}
\arguments{
\item{X}{Predictor matrix (n x p).}

\item{Y}{Response matrix (n x q).}

\item{lambdas}{Candidate regularization values.}

\item{groups}{Optional group structure for blockwise sparsity.}

\item{r}{Target rank.}

\item{standardize}{Whether to scale variables after centering.}

\item{rho}{ADMM penalty parameter.}

\item{B0}{Optional warm start for the coefficient matrix.}

\item{nfold}{Number of cross-validation folds.}

\item{select}{Selection rule for the final lambda. One of \code{"lambda.min"} or \code{"lambda.1se"}.}

\item{eps}{Convergence tolerance for the final ADMM refit.}

\item{maxiter}{Maximum iterations for the final ADMM refit.}

\item{verbose}{Whether to print diagnostics.}

\item{maxiter_cv}{Maximum iterations used inside the cross-validation fits.}

\item{parallel}{Whether to parallelize cross-validation.}

\item{nb_cores}{Number of worker processes to use when \code{parallel = TRUE}.}

\item{set_seed_cv}{Optional random seed for fold generation.}

\item{scoring_method}{Cross-validation score to optimize. One of \code{"mse"} or \code{"trace"}.}

\item{cv_use_median}{Whether to aggregate fold scores with the median instead of the mean.}

\item{dense}{Retained for backward compatibility.}

\item{optimized}{Retained for backward compatibility.}

\item{epsilon_sv}{Numerical threshold used to discard near-zero singular values.}

\item{ridge_whiten}{Ridge added when whitening Gram matrices.}
}
\value{
A list with the final fit, selected lambda, and cross-validation
scores when more than one lambda is supplied.
}
\description{
Selects a regularization parameter for \code{\link[=ecca]{ecca()}} by cross-validation and
refits the final model at the selected value.
}
