GetMAP | R Documentation |
Get the maximum a posteriori state
GetMAP(x)
x |
A collection of unique objects or chains object. |
A list with the adjacency matrix for the map and it's posterior probability. It is possible for it to return multiple DAGs. The list has elements;
state: List of MAP DAGs.
log_p: Numeric vector with the log posterior probability for each state.
log_state_score: Numeric vector representing the log score for each state.
log_norm_state_score: Numeric vector representing the log of the normalised score for each state.
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)
# Get the MAP per chain. Can be helpful to compare chains.
GetMAP(results)
# Get MAP across all chains.
results |>
FlattenChains() |>
GetMAP()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.