% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/coef.R
\name{coef.krr}
\alias{coef.krr}
\title{Extract Model Coefficients from a Fitted KRR Model}
\usage{
\method{coef}{krr}(object, ...)
}
\arguments{
\item{object}{An S3 object of class \code{krr}, typically returned by
\code{\link{fastkrr}}.}

\item{...}{Additional arguments (currently ignored).}
}
\value{
A numeric vector of the estimated model coefficients (\eqn{\alpha} or \eqn{\beta}).
}
\description{
Extracts the estimated coefficients from a fitted Kernel Ridge Regression (KRR) model.
The type of coefficient reported depends on the kernel approximation method:
for \code{opt = "exact"}, \code{"nystrom"}, or \code{"pivoted"}, the coefficients represent
the dual weights \eqn{\alpha}. For \code{opt = "rff"}, they represent the coefficients \eqn{\beta}.
}
\examples{
# Data setting
set.seed(1)
lambda = 1e-4
d = 1
n = 50
rho = 1
X = matrix(runif(n*d, 0, 1), nrow = n, ncol = d)
y = sin(2 * pi * rowMeans(X)^3) + rnorm(n, mean = 0, sd = 0.1)

data = data.frame(X, y = y)

# Example: exact
model = fastkrr(data = data, response = "y",
                 kernel = "gaussian", opt = "exact",
                 rho = rho, lambda = lambda)

coef(model)

}
\seealso{
\code{\link{fastkrr}}
}
