PartitionMCMC: Transition objects. Partition MCMC

View source: R/partition_mcmc_step.R

PartitionMCMCR Documentation

Transition objects. Partition MCMC

Description

This is a constructor for a single Tempered Partition MCMC step. The function constructs an environment with the proposal, inverse temperature, and verbose flag. It then returns a function that takes the current_state and a scorer object. This only allows the scores to be raised to a constant temperature for every step.

Usage

PartitionMCMC(
  proposal = DefaultProposal(),
  temperature = 1,
  prerejection = TRUE,
  verbose = TRUE
)

Arguments

proposal

Proposal function. Default is the DefaultProposal.

temperature

Numeric value representing the temperature to raise the score to. Default is 1.

prerejection

Boolean flag to reject due to the proposal disobeying the black or white lists. Only set to FALSE if you want to understand how often you are proposing states that disobey the black or white lists. Can be useful for debugging or understanding the efficiency of specific proposal distributions.

verbose

Flag to pass MCMC information.

Details

One step implementation of the tempered partition MCMC.

Value

Function that takes the current state and scorer that outputs a new state.

Examples

dag <- UniformlySampleDAG(c('A', 'B', 'C', 'D', 'E', 'F'))
partitioned_nodes <- DAGtoPartition(dag)

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

current_state <- list(
  state = partitioned_nodes,
  log_score = ScoreLabelledPartition(partitioned_nodes, scorer)
  )

pmcmc <- PartitionMCMC(proposal = DefaultProposal(), temperature = 1.0)
pmcmc(current_state, scorer)


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