% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/keras_api.R
\name{compile.ggml_sequential_model}
\alias{compile.ggml_sequential_model}
\alias{compile.ggml_functional_model}
\title{Compile a Model}
\usage{
\method{compile}{ggml_sequential_model}(
  object,
  optimizer = "adam",
  loss = "categorical_crossentropy",
  metrics = c("accuracy"),
  ...
)

\method{compile}{ggml_functional_model}(
  object,
  optimizer = "adam",
  loss = "categorical_crossentropy",
  metrics = c("accuracy"),
  ...
)
}
\arguments{
\item{object}{A model object (e.g. \code{ggml_sequential_model} or
\code{ggml_functional_model}).}

\item{optimizer}{Character: \code{"adam"}, \code{"adamw"}, or \code{"sgd"}.}

\item{loss}{Character: \code{"categorical_crossentropy"} or \code{"mse"}.}

\item{metrics}{Character vector of metrics (default \code{"accuracy"}).}

\item{...}{Additional arguments passed to \code{\link{ggml_compile}}.}
}
\value{
The compiled model (invisibly).
}
\description{
Configures the model for training by setting the optimizer, loss function,
and metrics.  This is the keras-compatible interface; it delegates to
\code{\link{ggml_compile}}.
}
\examples{
\donttest{
model <- ggml_model_sequential() |>
  ggml_layer_dense(10, activation = "softmax", input_shape = 4)
model <- compile(model, optimizer = "adam",
                 loss = "categorical_crossentropy")
}
}
