% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/featured_space.R
\name{maxent_fit}
\alias{maxent_fit}
\title{Train a MaxEnt Model}
\usage{
maxent_fit(
  featured_space,
  max_iter = 500L,
  convergence = 1e-05,
  beta_multiplier = 1,
  min_deviation = 0.001
)
}
\arguments{
\item{featured_space}{External pointer to a FeaturedSpace object (from
\code{maxent_featured_space()}).}

\item{max_iter}{Maximum number of training iterations (default 500).}

\item{convergence}{Convergence threshold: stop when the per-20-iteration
loss improvement is below this value (default 1e-5).}

\item{beta_multiplier}{Regularization multiplier (default 1.0). Higher
values increase regularization strength.}

\item{min_deviation}{Minimum sample deviation floor used in regularization
(default 0.001).}
}
\value{
Named list with:
  \describe{
    \item{loss}{Final regularized loss (scalar).}
    \item{entropy}{Shannon entropy of the trained distribution.}
    \item{iterations}{Number of training iterations completed.}
    \item{converged}{Logical: whether the convergence threshold was reached.}
    \item{lambdas}{Numeric vector of final lambda (weight) values.}
  }
}
\description{
Runs the sequential coordinate-ascent MaxEnt optimization on a FeaturedSpace.
}
\examples{
n   <- 50L
idx <- c(5L, 15L, 25L, 35L, 45L)
env <- list(bio1 = runif(n), bio12 = runif(n))
feats <- maxent_generate_features(env, types = "linear")
fs  <- maxent_featured_space(n, idx, feats)
result <- maxent_fit(fs, max_iter = 100, convergence = 1e-5)
result$loss
}
