Skip to contents

Initialise states for SampleChains. Initialise partition state for SampleChains.

Usage

InitPartition(nodes, scorer, init_state = NULL, n_parallel_chains = 2)

Arguments

nodes

A character vector of node names.

scorer

A scorer object.

init_state

A data.frame representing a partition. Default is NULL.

n_parallel_chains

Number of parallel chains to be run in SampleChains. Default is 2.

Examples

data <- bnlearn::learning.test

scorer <- CreateScorer(
  scorer = BNLearnScorer,
  data = data
  )
InitPartition(colnames(data), scorer)
#> [[1]]
#> [[1]]$state
#>   partition node
#> 1         1    F
#> 2         2    C
#> 3         3    A
#> 4         3    E
#> 5         4    D
#> 6         5    B
#> 
#> [[1]]$log_score
#> [1] -24564.87
#> 
#> [[1]]$proposal_info
#> NULL
#> 
#> [[1]]$mcmc_info
#> NULL
#> 
#> 
#> [[2]]
#> [[2]]$state
#>   partition node
#> 1         1    E
#> 2         2    C
#> 3         2    D
#> 4         3    B
#> 5         4    F
#> 6         5    A
#> 
#> [[2]]$log_score
#> [1] -24614.82
#> 
#> [[2]]$proposal_info
#> NULL
#> 
#> [[2]]$mcmc_info
#> NULL
#> 
#>