% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/svgd.R
\name{run_svgd}
\alias{run_svgd}
\title{Run SVGD inference on a phase-type distribution}
\usage{
run_svgd(
  graph,
  observed_data,
  theta_dim,
  n_particles = 100L,
  n_iterations = 1000L,
  learning_rate = 0.01,
  discrete = FALSE,
  rewards = NULL,
  ...
)
}
\arguments{
\item{graph}{Graph object (parameterized)}

\item{observed_data}{Numeric vector or matrix of observed data}

\item{theta_dim}{Integer dimension of parameter space}

\item{n_particles}{Integer number of particles (default 100)}

\item{n_iterations}{Integer number of iterations (default 1000)}

\item{learning_rate}{Numeric learning rate (default 0.01)}

\item{discrete}{Logical, whether distribution is discrete (default FALSE)}

\item{rewards}{Optional numeric vector or matrix of rewards}

\item{...}{Additional arguments passed to SVGD}
}
\value{
List with posterior mean, std, particles, and convergence info
}
\description{
High-level convenience function for running SVGD inference on phase-type
distribution models.
}
\details{
This function wraps the complete SVGD workflow:
\enumerate{
\item Creates model from graph
\item Initializes SVGD with observed data
\item Runs optimization
\item Returns posterior summaries
}
}
\examples{
\dontrun{
# Build parameterized coalescent model
coalescent_callback <- function(state) {
  n <- state[1]
  if (n <= 1) return(list())
  rate <- n * (n - 1) / 2
  list(list(c(n - 1), 0.0, c(rate)))
}
graph <- create_graph(callback = coalescent_callback, parameterized = TRUE, nr_samples = 5)

# Simulate some data
observed_times <- c(1.5, 2.3, 0.8, 1.2, 2.1)

# Run SVGD
results <- run_svgd(
  graph = graph,
  observed_data = observed_times,
  theta_dim = 1,
  n_particles = 100,
  n_iterations = 1000
)

print(results$theta_mean)
print(results$theta_std)
}

}
