plot.bnns: Plot diagnostics for a fitted Bayesian Neural Network

View source: R/bnns.R

plot.bnnsR Documentation

Plot diagnostics for a fitted Bayesian Neural Network

Description

Generates Markov Chain Monte Carlo (MCMC) trace plots, posterior density plots, Posterior Predictive Checks (PPC), or predicted probability distributions for the fitted model.

Usage

## S3 method for class 'bnns'
plot(
  x,
  type = c("trace", "density", "posterior_predictive", "pred_prob"),
  pars = NULL,
  ...
)

Arguments

x

A fitted bnns model object.

type

Character string indicating the type of plot. Options are "trace" for MCMC trace plots, "density" for posterior density plots, "posterior_predictive" for Posterior Predictive Checks, and "pred_prob" for visualizing the predicted class probability distributions (classification only).

pars

A character vector of parameter names to include in the plot. By default, this focuses on the output layer ("w_out", "b_out", and "sigma") to avoid cluttering the plot device with hundreds of hidden layer weights.

...

Additional arguments passed to stan_trace, stan_dens, or ppc_dens_overlay.

Value

A ggplot object containing the requested diagnostic plots.


bnns documentation built on June 8, 2026, 1:06 a.m.