% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/keras_api.R
\name{fit.ggml_sequential_model}
\alias{fit.ggml_sequential_model}
\alias{fit.ggml_functional_model}
\title{Train a Model}
\usage{
\method{fit}{ggml_sequential_model}(
  object,
  x,
  y,
  epochs = 1L,
  batch_size = 32L,
  validation_split = 0,
  validation_data = NULL,
  verbose = 1L,
  callbacks = list(),
  ...
)

\method{fit}{ggml_functional_model}(
  object,
  x,
  y,
  epochs = 1L,
  batch_size = 32L,
  validation_split = 0,
  validation_data = NULL,
  verbose = 1L,
  callbacks = list(),
  ...
)
}
\arguments{
\item{object}{A compiled model object.}

\item{x}{Training data.  Matrix, array, or list of matrices (multi-input).}

\item{y}{Training labels (matrix, one-hot encoded for classification).}

\item{epochs}{Number of training epochs (default 1).}

\item{batch_size}{Batch size (default 32).}

\item{validation_split}{Fraction of data for validation (default 0).}

\item{validation_data}{Optional \code{list(x_val, y_val)}.}

\item{verbose}{0 = silent, 1 = progress (default 1).}

\item{callbacks}{List of callback objects (default \code{list()}).}

\item{...}{Additional arguments passed to \code{\link{ggml_fit}}.}
}
\value{
The trained model (invisibly), with \code{model$history}.
}
\description{
Trains the model on data for a fixed number of epochs.  This is the
keras-compatible interface; it delegates to \code{\link{ggml_fit}}.
}
\examples{
\donttest{
model <- ggml_model_sequential() |>
  ggml_layer_dense(10, activation = "softmax", input_shape = 4)
model <- compile(model, optimizer = "adam",
                 loss = "categorical_crossentropy")
# model <- fit(model, x_train, y_train, epochs = 5, batch_size = 32)
}
}
