% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/batch-means.R
\name{compute_ngme_sgld_samples}
\alias{compute_ngme_sgld_samples}
\title{Refit an Existing ngme Object with SGLD and Extract Samples}
\usage{
compute_ngme_sgld_samples(
  fit,
  iterations = 4000,
  optimizer = sgld(stepsize = 0.01, temperature = 1),
  burnin = 100,
  n_batch = 20,
  n_parallel_chain = 4,
  alpha = 0.6,
  t0 = 10,
  start_sd = 0.2,
  seed = Sys.time(),
  verbose = FALSE,
  name = "all",
  burnin_iter = 0,
  thinning = 1,
  n_gibbs_samples = NULL,
  apply_transform = TRUE,
  combine_chains = TRUE,
  control_opt = NULL,
  ...
)
}
\arguments{
\item{fit}{existing fitted `ngme` object (can be obtained with any optimizer).}

\item{iterations}{optimization iterations for the SGLD stage.}

\item{optimizer}{optimizer for the sampling stage; must be `sgld(...)`.}

\item{burnin}{burn-in iterations before optimization.}

\item{n_batch}{number of optimization checkpoints.}

\item{n_parallel_chain}{number of parallel chains.}

\item{alpha}{polynomial schedule exponent used by `poly_decay(alpha, t0)`.}

\item{t0}{non-negative schedule offset.}

\item{start_sd}{standard deviation for randomized chain initialization.}

\item{seed}{random seed for SGLD stage.}

\item{verbose}{logical; print optimization progress.}

\item{name}{parameter block to extract: `"all"` (default), latent model name,
or `"general"`.}

\item{burnin_iter}{non-negative integer used both as optimizer schedule
warmup (`stepsize_schedule_burnin_iter`) and as explicit trajectory
trimming before sampling.}

\item{thinning}{positive integer thinning interval.}

\item{n_gibbs_samples}{optional positive integer. If supplied, override
`control_ngme$n_gibbs_samples` for the SGLD refit stage only; otherwise
inherit the value from `fit`.}

\item{apply_transform}{logical; apply parameter transforms to user scale.}

\item{combine_chains}{logical; if `TRUE`, return one combined data.frame,
otherwise return one data.frame per chain.}

\item{control_opt}{optional pre-built `control_opt` object for the SGLD
stage. If supplied, it is used directly (with `store_traj` forced to
`TRUE`).}

\item{...}{additional arguments forwarded to [control_opt()] when
`control_opt` is `NULL`.}
}
\value{
A data.frame (or list of data.frames) from [ngme_sgld_samples()]
with extra attributes `refit`, `refit_control_opt`, and `refit_source`.
}
\description{
Run one additional SGLD stage (warm-started from an existing `ngme` fit),
then extract posterior-like samples from stored trajectories.
}
