% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/HelperFunctions.R
\name{.compute_loocv_gradient}
\alias{.compute_loocv_gradient}
\title{Compute Closed-Form Gradient of Exact Leave-One-Out Criterion}
\usage{
.compute_loocv_gradient(par, log_penalty_vec, outlist = NULL, env, ...)
}
\arguments{
\item{par}{Numeric vector; log-scale penalty parameters.}

\item{log_penalty_vec}{Numeric vector; log-scale predictor/partition
penalties.}

\item{outlist}{List or NULL; cached results from \code{.compute_loocv()}.}

\item{env}{List; tuning environment.}

\item{...}{Additional arguments passed to fitting functions.}
}
\value{
List with \code{criterion_value}, \code{gradient}, and
  \code{outlist}.
}
\description{
Computes the analytical gradient of the exact leave-one-out tuning
criterion with respect to the log penalty parameters.
}
\details{
The implementation below keeps the exact LOO gradient fully analytic,
including the leverage derivative. In empirical diagnostics, the
observation-wise leverage component can be numerically delicate even when
the aggregate gradient remains informative; see the developer diagnostics in
\code{inst/diagnostics/gradient_diagnostics.R} for inspection tools.
}
\keyword{internal}
