Skip to contents

Initialise partition state for SampleChains. [Experimental]

Usage

InitCoupledPartition(
  nodes,
  scorer,
  init_state = NULL,
  n_coupled_chains = 4,
  n_parallel_chains = 2
)

Arguments

nodes

A character vector of node names.

scorer

A scorer object.

init_state

Coupled partition state. Default is NULL.

n_coupled_chains

Number of coupled chains. Default is 4.

n_parallel_chains

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

Examples

scorer <- CreateScorer(
  scorer = BNLearnScorer,
  data = bnlearn::learning.test
  )
nodes <- names(bnlearn::learning.test)

InitCoupledPartition(nodes, scorer)
#> [[1]]
#> [[1]]$state
#>   partition node
#> 1         1    F
#> 2         2    A
#> 3         2    E
#> 4         3    B
#> 5         4    C
#> 6         5    D
#> 
#> [[1]]$log_score
#> [1] -24375.19
#> 
#> [[1]]$proposal_info
#> NULL
#> 
#> [[1]]$mcmc_info
#> [[1]]$mcmc_info[[1]]
#> [[1]]$mcmc_info[[1]]$state
#>   partition node
#> 1         1    F
#> 2         2    A
#> 3         2    E
#> 4         3    B
#> 5         4    C
#> 6         5    D
#> 
#> [[1]]$mcmc_info[[1]]$log_score
#> [1] -24375.19
#> 
#> 
#> [[1]]$mcmc_info[[2]]
#> [[1]]$mcmc_info[[2]]$state
#>   partition node
#> 1         1    F
#> 2         2    A
#> 3         2    E
#> 4         3    B
#> 5         4    C
#> 6         5    D
#> 
#> [[1]]$mcmc_info[[2]]$log_score
#> [1] -24375.19
#> 
#> 
#> [[1]]$mcmc_info[[3]]
#> [[1]]$mcmc_info[[3]]$state
#>   partition node
#> 1         1    F
#> 2         2    A
#> 3         2    E
#> 4         3    B
#> 5         4    C
#> 6         5    D
#> 
#> [[1]]$mcmc_info[[3]]$log_score
#> [1] -24375.19
#> 
#> 
#> [[1]]$mcmc_info[[4]]
#> [[1]]$mcmc_info[[4]]$state
#>   partition node
#> 1         1    F
#> 2         2    A
#> 3         2    E
#> 4         3    B
#> 5         4    C
#> 6         5    D
#> 
#> [[1]]$mcmc_info[[4]]$log_score
#> [1] -24375.19
#> 
#> 
#> 
#> 
#> [[2]]
#> [[2]]$state
#>   partition node
#> 1         1    B
#> 2         1    C
#> 3         2    E
#> 4         3    D
#> 5         4    F
#> 6         5    A
#> 
#> [[2]]$log_score
#> [1] -24609.18
#> 
#> [[2]]$proposal_info
#> NULL
#> 
#> [[2]]$mcmc_info
#> [[2]]$mcmc_info[[1]]
#> [[2]]$mcmc_info[[1]]$state
#>   partition node
#> 1         1    B
#> 2         1    C
#> 3         2    E
#> 4         3    D
#> 5         4    F
#> 6         5    A
#> 
#> [[2]]$mcmc_info[[1]]$log_score
#> [1] -24609.18
#> 
#> 
#> [[2]]$mcmc_info[[2]]
#> [[2]]$mcmc_info[[2]]$state
#>   partition node
#> 1         1    B
#> 2         1    C
#> 3         2    E
#> 4         3    D
#> 5         4    F
#> 6         5    A
#> 
#> [[2]]$mcmc_info[[2]]$log_score
#> [1] -24609.18
#> 
#> 
#> [[2]]$mcmc_info[[3]]
#> [[2]]$mcmc_info[[3]]$state
#>   partition node
#> 1         1    B
#> 2         1    C
#> 3         2    E
#> 4         3    D
#> 5         4    F
#> 6         5    A
#> 
#> [[2]]$mcmc_info[[3]]$log_score
#> [1] -24609.18
#> 
#> 
#> [[2]]$mcmc_info[[4]]
#> [[2]]$mcmc_info[[4]]$state
#>   partition node
#> 1         1    B
#> 2         1    C
#> 3         2    E
#> 4         3    D
#> 5         4    F
#> 6         5    A
#> 
#> [[2]]$mcmc_info[[4]]$log_score
#> [1] -24609.18
#> 
#> 
#> 
#>