Skip to contents

This makes the assumption that the proposal has saved a variable "proposal_used" and mcmc has saved a variable 'accept'.

Usage

CalculateAcceptanceRates(chains, group_by = NULL)

Arguments

chains

MCMC chains.

group_by

Vector of strings that are in c("chain", "proposal_used"). Default is NULL which will return the acceptance rates marginalised over chains and the proposal used.

Value

Summary of acceptance rates per grouping.

Examples

data <- bnlearn::learning.test

scorer <- CreateScorer(
  scorer = BNLearnScorer, 
  data = data
  )
init_state <- InitPartition(colnames(data), scorer)
#> Loading required namespace: igraph

results <- SampleChains(10, init_state, PartitionMCMC(), scorer)
CalculateAcceptanceRates(results)
#> # A tibble: 1 × 5
#>   mean_accept mean_black_obeyed mean_white_obeyed n_accept n_total
#>         <dbl>             <dbl>             <dbl>    <int>   <int>
#> 1         0.3                 1                 1        6      20