% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/default_mlp.R
\name{ggml_default_mlp}
\alias{ggml_default_mlp}
\title{Default MLP builder for classification and regression}
\usage{
ggml_default_mlp(
  n_features,
  n_out,
  task_type = c("classif", "regr"),
  hidden_layers = c(128L, 64L),
  activation = "relu",
  dropout = 0.2
)
}
\arguments{
\item{n_features}{Integer. Number of input features. Required.}

\item{n_out}{Integer. Number of output units. For classification this is the
number of classes; for regression this is typically 1.}

\item{task_type}{Character. One of \code{"classif"} or \code{"regr"}. Controls
the final layer's activation.}

\item{hidden_layers}{Integer vector. Widths of the hidden dense layers.
Default \code{c(128L, 64L)}. Pass \code{integer(0)} for a linear model.}

\item{activation}{Character. Activation applied to each hidden layer.
Default \code{"relu"}. Passed through to \code{\link{ggml_layer_dense}}.}

\item{dropout}{Numeric in \code{[0, 1)}. Dropout rate applied after each
hidden layer. Set to \code{0} to disable dropout. Default \code{0.2}.}
}
\value{
An uncompiled \code{ggml_sequential_model} object. Call
  \code{\link{ggml_compile}} before \code{\link{ggml_fit}}.
}
\description{
Constructs an uncompiled sequential multi-layer perceptron suitable as a
starting point for tabular classification or regression. This is the default
\code{model_fn} used by \code{LearnerClassifGGML} and \code{LearnerRegrGGML}
when the user does not supply a custom builder, and it is also exported for
direct use or as a template for user-defined builders.
}
\details{
The returned model is \strong{not compiled}: the caller is responsible for
calling \code{\link{ggml_compile}} with the appropriate loss
(\code{"categorical_crossentropy"} for classification, \code{"mse"} for
regression) before training.

The final layer is chosen based on \code{task_type}:
\itemize{
  \item \code{"classif"} — dense with \code{units = n_out} and softmax activation.
  \item \code{"regr"}    — dense with \code{units = n_out} and no activation
    (identity / linear output).
}
}
\examples{
\dontrun{
# 3-class classifier on 20 features
model <- ggml_default_mlp(
  n_features   = 20L,
  n_out        = 3L,
  task_type    = "classif",
  hidden_layers = c(64L, 32L),
  dropout      = 0.1
)
model <- ggml_compile(model, optimizer = "adam",
                      loss = "categorical_crossentropy")

# Single-output regressor
reg <- ggml_default_mlp(
  n_features = 10L,
  n_out      = 1L,
  task_type  = "regr"
)
reg <- ggml_compile(reg, optimizer = "adam", loss = "mse")
}
}
\seealso{
\code{\link{ggml_model_sequential}}, \code{\link{ggml_layer_dense}},
  \code{\link{ggml_layer_dropout}}, \code{\link{ggml_compile}}
}
