Skip to contents

Index a cia_post_chains object.

Usage

# S3 method for class 'cia_post_chains'
x[[i, ...]]

Arguments

x

A cia_post_chains object.

i

An index to get the cia_post_chain.

...

ellipsis for extra indexing parameters.

Value

chain A cia_post_chains object.

Examples

data <- bnlearn::learning.test

dag <- UniformlySampleDAG(colnames(data))
partitioned_nodes <- DAGtoPartition(dag)

scorer <- CreateScorer(
  scorer = BNLearnScorer, 
  data = data
  )

results <- SampleChains(10, partitioned_nodes, PartitionMCMC(), scorer)
dag_chains <- PartitiontoDAG(results, scorer)

pedge_sample <- SampleEdgeProbabilities(dag_chains)
head(pedge_sample[[1]])
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
#> [1,]    0    0    0    0    0    0    1    0    1     0     1     0     0     0
#> [2,]    0    0    0    0    0    0    1    0    1     0     1     0     0     0
#> [3,]    0    1    0    0    0    0    0    0    1     0     1     0     0     0
#> [4,]    0    1    0    0    0    0    0    0    0     0     1     0     0     0
#> [5,]    0    1    0    0    0    0    0    0    0     0     1     0     0     0
#> [6,]    0    1    0    0    0    0    0    0    0     0     1     0     0     0
#>      [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26]
#> [1,]     0     0     1     0     1     0     1     0     0     1     1     0
#> [2,]     0     0     1     0     1     0     1     0     0     1     1     0
#> [3,]     0     0     1     0     1     0     1     0     0     1     0     0
#> [4,]     0     0     0     0     1     0     1     0     0     1     0     0
#> [5,]     0     0     0     0     1     0     1     0     0     1     0     0
#> [6,]     0     0     0     0     1     0     1     0     0     1     0     0
#>      [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36]
#> [1,]     0     0     0     0     0     1     0     0     1     0
#> [2,]     0     0     0     0     0     1     0     0     1     0
#> [3,]     0     0     0     0     1     1     0     0     1     0
#> [4,]     1     0     0     0     1     1     0     0     1     0
#> [5,]     1     0     0     0     1     1     0     0     1     0
#> [6,]     1     0     0     0     1     1     0     0     1     0
#> attr(,"class")
#> [1] "cia_post_chain"