predict_bn: Performs inference over a fitted GBN

View source: R/dbn_inference.R

predict_bnR Documentation

Performs inference over a fitted GBN

Description

Performs inference over a Gaussian BN. It's thought to be used in a map for a data.table, to use as evidence each separate row. If not specifically needed, it's recommended to use the function predict_dt instead. This function is deprecated and will be removed in a future version.

Usage

predict_bn(fit, evidence)

Arguments

fit

the fitted bn

evidence

values of the variables used as evidence for the net

Value

a data.table with the predictions

Examples

size = 3
data(motor)
dt_train <- motor[200:2500]
dt_val <- motor[2501:3000]
net <- learn_dbn_struc(dt_train, size)
f_dt_train <- fold_dt(dt_train, size)
f_dt_val <- fold_dt(dt_val, size)
fit <- fit_dbn_params(net, f_dt_train, method = "mle-g")
res <- f_dt_val[, predict_bn(fit, .SD), .SDcols = c("pm_t_0", "coolant_t_0"), by = 1:nrow(f_dt_val)]

dbnR documentation built on Oct. 5, 2022, 1:07 a.m.