% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wrap_lightgbm.R
\name{wrap_lightgbm}
\alias{wrap_lightgbm}
\alias{predict.wrap_lightgbm}
\alias{print.wrap_lightgbm}
\title{S3 wrapper for lightgbm}
\usage{
wrap_lightgbm(x, y, ...)

\method{predict}{wrap_lightgbm}(object, newx, type = c("class", "prob"), ...)

\method{print}{wrap_lightgbm}(x, ...)
}
\arguments{
\item{x}{A matrix or data.frame of features.}

\item{y}{A factor or character vector for classification, numeric for regression.}

\item{...}{Additional arguments passed to [lightgbm::lgb.train()].
Pass `params = list(objective = "binary")` for binary classification,
`params = list(objective = "multiclass", num_class = k)` for multiclass,
or `params = list(objective = "regression")` for regression.}

\item{object}{A fitted `wrap_lightgbm` object.}

\item{newx}{A matrix or data.frame of new observations.}

\item{type}{`"class"` (default) for class labels, `"prob"` for a probability
matrix. Ignored for regression.}
}
\value{
An object of class `wrap_lightgbm` with fields:
  \item{fit}{The fitted lgb.Booster model.}
  \item{levels}{Class levels (NULL for regression).}
  \item{task}{"classification" or "regression".}
  \item{objective}{The lightgbm objective string, stored at fit time.}
}
\description{
Fits a `lightgbm` model with a consistent interface.
Supports binary classification, multiclass classification, and regression.
}
\examples{

library(mlS3)

X <- iris[, 1:4]
y <- iris$Species
mod <- wrap_lightgbm(X, y,
  params = list(objective = "multiclass", num_class = 3, verbose = -1),
  nrounds = 50)
predict(mod, newx = X, type = "class")
predict(mod, newx = X, type = "prob")

}
