Skip to contents

Scorer constructor

Usage

CreateScorer(
  scorer = BNLearnScorer,
  ...,
  max_parents = Inf,
  blacklist = NULL,
  whitelist = NULL,
  cache = FALSE,
  nthreads = 1
)

Arguments

scorer

A scorer function that takes (node, parents) as parameters. Default is BNLearnScorer.

...

Parameters to pass to scorer.

max_parents

The maximum number of allowed parents. Default is infinite.

blacklist

A boolean matrix of (parent, child) pairs where TRUE represents edges that cannot be in the DAG. Default is NULL which represents no blacklisting.

whitelist

A boolean matrix of (parent, child) pairs where TRUE represents edges that must be in the DAG. Default is NULL which represents no whitelisting.

cache

A boolean to indicate whether to build the cache. The cache only works for problems where the scorer only varies as a function of (node, parents). Default is FALSE.

nthreads

Number of threads used to construct cache.

Value

A list with entries:

  • scorer: Function that takes (node, parents) as parameters and returns the score.

  • parameters: List of extra parameters passed to the scorer.

  • max_parents: Integer representing the maximum number of possible possible parents that any child can have.

  • blacklist: Matrix where each cell represents the (parent, child) pairs that must not be present when equal to 1.

  • whitelist: Matrix where each cell represents the (parent, child) pairs that must be present when equal to 1. state estimated using the MCMC sampling frequency.

Examples

scorer <- CreateScorer(data = bnlearn::asia)