tests/testthat/test_partition_to_dag.R

data <- bnlearn::learning.test

set.seed(1)
dag <- UniformlySampleDAG(colnames(data))
partitioned_nodes <- DAGtoPartition(dag)

scorer <- CreateScorer(data = data)

testthat::test_that('SampleDAGFromLabelledPartition works', {
  testthat::expect_equal(colnames(SampleDAGFromLabelledPartition(partitioned_nodes, scorer)$state), colnames(data))
  testthat::expect_equal(rownames(SampleDAGFromLabelledPartition(partitioned_nodes, scorer)$state), colnames(data))
})

Try the cia package in your browser

Any scripts or data that you put into this service are public.

cia documentation built on April 4, 2025, 5:23 a.m.