summary.bnns {bnns} | R Documentation |
Summary of a Bayesian Neural Network (BNN) Model
Description
Provides a comprehensive summary of a fitted Bayesian Neural Network (BNN) model, including details about the model call, data, network architecture, posterior distributions, and model fitting information.
Usage
## S3 method for class 'bnns'
summary(object, ...)
Arguments
object |
An object of class |
... |
Additional arguments (currently unused). |
Details
The function prints the following information:
-
Call: The original function call used to fit the model.
-
Data Summary: Number of observations and features in the training data.
-
Network Architecture: Structure of the BNN including the number of hidden layers, nodes per layer, and activation functions.
-
Posterior Summary: Summarized posterior distributions of key parameters (e.g., weights, biases, and noise parameter).
-
Model Fit Information: Bayesian sampling details, including the number of iterations, warmup period, thinning, and chains.
-
Notes: Remarks and warnings, such as checks for convergence diagnostics.
Value
A list (returned invisibly) containing the following elements:
-
"Number of observations"
: The number of observations in the training data. -
"Number of features"
: The number of features in the training data. -
"Number of hidden layers"
: The number of hidden layers in the neural network. -
"Nodes per layer"
: A comma-separated string representing the number of nodes in each hidden layer. -
"Activation functions"
: A comma-separated string representing the activation functions used in each hidden layer. -
"Output activation function"
: The activation function used in the output layer. -
"Stanfit Summary"
: A summary of the Stan model, including key parameter posterior distributions. -
"Iterations"
: The total number of iterations used for sampling in the Bayesian model. -
"Warmup"
: The number of iterations used as warmup in the Bayesian model. -
"Thinning"
: The thinning interval used in the Bayesian model. -
"Chains"
: The number of Markov chains used in the Bayesian model. -
"Performance"
: Predictive performance metrics, which vary based on the output activation function.
The function also prints the summary to the console.
See Also
Examples
# Fit a Bayesian Neural Network
data <- data.frame(x1 = runif(10), x2 = runif(10), y = rnorm(10))
model <- bnns(y ~ -1 + x1 + x2,
data = data, L = 1, nodes = 2, act_fn = 2,
iter = 1e1, warmup = 5, chains = 1
)
# Get a summary of the model
summary(model)