sample_motbfs: Generate Samples From an MoTBF Bayesian network

View source: R/Inference.R

sample_motbfsR Documentation

Generate Samples From an MoTBF Bayesian network

Description

This function generates a sample from an MoTBF Bayesian network.

Usage

sample_motbfs(bn, n, parallel = FALSE, evidence = NULL)

Arguments

bn

An object of class motbf_fit, obtained from the function motbf.fit.

n

A non-negative integer giving the number of instances to be generated.

parallel

A logical value. If TRUE, parallelization is carried out. As a default, it is set to FALSE

evidence

A data.frame of one row containing the values for the observed variables. As a default, it is NULL.

Value

A data.frame containing the generated sample. Is evidence is not NULL, attribute 'w' contains the weight of each sample.

Examples

  data("ecoli", package = "MoTBFs")
  dat <- ecoli[,-c(1,4,5,9)]
  
  # Build DAG
  dag <- LearningHC(dat)
  
  # Learn BN parameters
  bn = motbf.fit(dag, dat)
 
 # Get sample from bn
 sam = sample_motbfs(bn, 50)
 
 

MoTBFs documentation built on Oct. 6, 2026, 1:06 a.m.