Learn R Programming

LBBNN (version 0.1.2)

residuals.LBBNN_Net: Residuals from LBBNN fit

Description

Residuals from an object of the LBBNN_Net class.

Usage

# S3 method for LBBNN_Net
residuals(object, type = c("response"), ...)

Value

A numeric vector of residuals (y_true - y_predicted)

Arguments

object

An object of class LBBNN_Net.

type

Currently only 'response' is implemented i.e. y_true - y_predicted.

...

further arguments passed to or from other methods.

Examples

Run this code
# \donttest{ 
x<-torch::torch_randn(3,2) 
b <- torch::torch_rand(2)
y <- torch::torch_matmul(x,b)
train_data <- torch::tensor_dataset(x,y)
train_loader <- torch::dataloader(train_data,batch_size = 3,shuffle=FALSE)
problem<-'regression'
sizes <- c(2,1,1) 
inclusion_priors <-c(0.9,0.2) 
inclusion_inits <- matrix(rep(c(-10,10),2),nrow = 2,ncol = 2)
stds <- c(1.0,1.0)
model <- LBBNN_Net(problem,sizes,inclusion_priors,stds,inclusion_inits,flow = FALSE,
input_skip = TRUE)
train_LBBNN(epochs = 1,LBBNN = model, lr = 0.01,train_dl = train_loader)
residuals(model)
# }

Run the code above in your browser using DataLab