blacklist: Get or create whitelists and blacklists

Description Usage Arguments Details Value Author(s) Examples

View source: R/frontend-bn.R

Description

Extract whitelists and blacklists from an object of class bn, or create them for use in structure learning.

Usage

1
2
3
4
5
6

Arguments

x

an object of class bn.

nodes,set

a vector of character strings, the labels of the nodes.

tiers

a vector of character strings or a list, see below.

Details

ordering2blacklist() takes a vector of character strings (the labels of the nodes), which specifies a complete node ordering. An object of class bn or bn.fit; in that case, the node ordering is derived by the graph. In both cases, the blacklist returned by ordering2blacklist() contains all the possible arcs that violate the specified node ordering.

tiers2blacklist() takes (again) a vector of character strings (the labels of the nodes), which specifies a complete node ordering, or a list of character vectors, which specifies a partial node ordering. In the latter case, all arcs going from a node in a particular element of the list (sometimes known as tier) to a node in one of the previous elements are blacklisted. Arcs between nodes in the same element are not blacklisted.

set2blacklist() creates a blacklist containing all the arcs between any two of the nodes whose labels are passed as the argument set.

Value

whitelist() and blacklist() return a matrix of character string with two columns, named from and to, if whitelist or a blacklist have been used to learn the bn object passed as their argument.

ordering2blacklist(), tiers2blacklist() and set2blacklist() return a sanitized blacklist (a two-column matrix, whose columns are labeled from and to).

Author(s)

Marco Scutari

Examples

1
2
3

Example output

      from to 
 [1,] "D"  "A"
 [2,] "E"  "A"
 [3,] "F"  "A"
 [4,] "D"  "B"
 [5,] "E"  "B"
 [6,] "F"  "B"
 [7,] "D"  "C"
 [8,] "E"  "C"
 [9,] "F"  "C"
     from to 
[1,] "B"  "A"
[2,] "C"  "A"
[3,] "A"  "B"
[4,] "C"  "B"
[5,] "A"  "C"
[6,] "B"  "C"
      from to 
 [1,] "B"  "A"
 [2,] "C"  "A"
 [3,] "D"  "A"
 [4,] "E"  "A"
 [5,] "F"  "A"
 [6,] "C"  "B"
 [7,] "D"  "B"
 [8,] "E"  "B"
 [9,] "F"  "B"
[10,] "D"  "C"
[11,] "E"  "C"
[12,] "F"  "C"
[13,] "E"  "D"
[14,] "F"  "D"
[15,] "F"  "E"

bnlearn documentation built on Sept. 7, 2021, 1:07 a.m.