utilities for whitelists and blacklists {bnlearn} R Documentation

Get or create whitelists and blacklists

Description

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

Usage

whitelist(x)
blacklist(x)

ordering2blacklist(nodes)
tiers2blacklist(tiers)
set2blacklist(set)

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 from the graph. In both cases, ordering2blacklist() returns a blacklist containing 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 one list element (sometimes known as tier) to a node in 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 strings with two columns, named from and to, if a whitelist or a blacklist has 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 labelled from and to).

Author(s)

Marco Scutari

Examples

tiers2blacklist(list(LETTERS[1:3], LETTERS[4:6]))
set2blacklist(LETTERS[1:3])
ordering2blacklist(LETTERS[1:6])

[Package bnlearn version 5.2-20260704 Index]