GetLowestPairwiseScoringEdges: Preprocessing for blacklisting Get the lowest pairwise...

View source: R/pre_process.R

GetLowestPairwiseScoringEdgesR Documentation

Preprocessing for blacklisting Get the lowest pairwise scoring edges.

Description

Get the lowest pairwise scoring edges represented as a blacklist matrix. This blacklisting procedure is motivated by Koller & Friedman (2003). This is rarely used now as we found that it blacklists edges that have significant dependencies but are not in the top n edges. We prefer the GetIncrementalScoringEdges method.

Usage

GetLowestPairwiseScoringEdges(scorer, n_retain)

Arguments

scorer

A scorer object.

n_retain

An integer representing the number of edges to retain.

Value

A boolean matrix of (parent, child) pairs for blacklisting.

References

  1. Koller D, Friedman N. Being Bayesian about network structure. A Bayesian approach to structure discovery in Bayesian networks. Mach Learn. 2003;50(1):95–125.

Examples

data <- bnlearn::learning.test

scorer <- CreateScorer(
  scorer = BNLearnScorer, 
  data = data
  )
  
blacklist <- GetLowestPairwiseScoringEdges(scorer, 3)

blacklist_scorer <- CreateScorer(
  scorer = BNLearnScorer, 
  data = data,
  blacklist = blacklist,
  cache = TRUE
  )

# Randomly sample a starting DAG consistent with the blacklist. Then
# convert to a partition.
dag <- UniformlySampleDAG(colnames(data)) * !blacklist
partitioned_nodes <- DAGtoPartition(dag)

results <- SampleChains(10, partitioned_nodes, PartitionMCMC(), blacklist_scorer)


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