% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.R
\name{plot.krr}
\alias{plot.krr}
\title{Plot method for fitted Kernel Ridge Regression models}
\usage{
\method{plot}{krr}(x, show_points = TRUE, ...)
}
\arguments{
\item{x}{A fitted KRR model (class \code{"krr"}) returned by \code{\link{fastkrr}}.}

\item{show_points}{Logical; if \code{TRUE}, displays the original training data points
as a background layer. Default is \code{TRUE}.}

\item{...}{Additional arguments (currently ignored).}
}
\value{
A \code{ggplot} object showing the fitted regression line and training data.
}
\description{
Visualizes the fitted regression curve from a Kernel Ridge Regression (KRR) model.
Automatically generates predictions on a regular grid (1.2 times the training
sample size) and overlays them with the training data.
}
\details{
Currently, \code{plot.krr} supports only uni-variate inputs (\eqn{d = 1}).
For multivariate settings (\eqn{d \ge 2}), the plot method will return an error,
and users are encouraged to manually slice their data to visualize conditional
main effects.
}
\examples{
\donttest{
set.seed(1)
n = 1000
rho = 1
d = 1
X = matrix(runif(n*d, 0, 1), nrow = n, ncol = d); colnames(X) = paste0("X", seq_len(d))
y = sin(2 * pi * rowMeans(X)^3) + rnorm(n, mean = 0, sd = 0.1)

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

model_exact = fastkrr(data = data, response = "y",
                       kernel = "gaussian", rho = rho, opt = "exact", verbose = FALSE)
plot(model_exact)
}

}
\seealso{
\code{\link{fastkrr}}, \code{\link{predict.krr}}
}
