learn.dynamic.network: learn a dynamic network (structure and parameters) of a BN...

Description Usage Arguments Details Value See Also Examples

Description

Learn a dynamic network (structure and parameters) of a BN from a BNDataset (see the Details section). This method is a wrapper for learn.network to simplify the learning of a dynamic network. It provides an automated generation of the layering required to represent the set of time constraints encoded in a dynamic network. In this function, it is assumed that the dataset contains the observations for each variable in all the time steps: V_1^{t_1}, V_2^{t_1}, V_n^{t_1}, V_1^{t_2}, ... , V_n^{t_k}. Variables in time step j can be parents for any variable in time steps k>=j, but not for variables i<j. If a layering is provided for a time step, it is valid in each time step, and not throughout the whole dynamic network; a global layering can however be provided.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
learn.dynamic.network(x, ...)

## S4 method for signature 'BN'
learn.dynamic.network(
  x,
  y = NULL,
  num.time.steps = num.time.steps(y),
  algo = "mmhc",
  scoring.func = "BDeu",
  initial.network = NULL,
  alpha = 0.05,
  ess = 1,
  bootstrap = FALSE,
  layering = c(),
  max.fanin = num.variables(y) - 1,
  max.fanin.layers = NULL,
  max.parents = num.variables(y) - 1,
  max.parents.layers = NULL,
  layer.struct = NULL,
  cont.nodes = c(),
  use.imputed.data = FALSE,
  use.cpc = TRUE,
  mandatory.edges = NULL,
  ...
)

## S4 method for signature 'BNDataset'
learn.dynamic.network(
  x,
  num.time.steps = num.time.steps(x),
  algo = "mmhc",
  scoring.func = "BDeu",
  initial.network = NULL,
  alpha = 0.05,
  ess = 1,
  bootstrap = FALSE,
  layering = c(),
  max.fanin = num.variables(x) - 1,
  max.fanin.layers = NULL,
  max.parents = num.variables(x) - 1,
  max.parents.layers = NULL,
  layer.struct = NULL,
  cont.nodes = c(),
  use.imputed.data = FALSE,
  use.cpc = TRUE,
  mandatory.edges = NULL,
  ...
)

Arguments

x

can be a BN or a BNDataset. If x is a BN, then also the dataset parameter must be given.

...

potential further arguments for methods.

y

a BNDataset object, to be provided only if x is a BN.

num.time.steps

the number of time steps to be represented in the dynamic BN.

algo

the algorithm to use. Currently, one among sm (Silander-Myllymaki), mmpc (Max-Min Parent-and-Children), mmhc (Max-Min Hill Climbing, default), hc (Hill Climbing) and sem (Structural Expectation Maximization).

scoring.func

the scoring function to use. Currently, one among BDeu, AIC, BIC.

initial.network

network structure to be used as starting point for structure search. Can take different values: a BN object, a matrix containing the adjacency matrix of the structure of the network, or the string random.chain to sample a random chain as starting point.

alpha

confidence threshold (only for mmhc).

ess

Equivalent Sample Size value.

bootstrap

TRUE to use bootstrap samples.

layering

vector containing the layers each node belongs to.

max.fanin

maximum number of parents for each node (only for hc, mmhc).

max.fanin.layers

matrix of available parents in each layer (only for sm – DEPRECATED, use max.parents.layers instead).

max.parents

maximum number of parents for each node (for sm, hc, mmhc).

max.parents.layers

matrix of available parents in each layer (only for sm).

layer.struct

0/1 matrix for indicating which layers can contain parent nodes for nodes in a layer (only for mmhc, mmpc).

cont.nodes

vector containing the index of continuous variables.

use.imputed.data

TRUE to learn the structure from the imputed dataset (if available, a check is performed). Default is to use raw dataset

use.cpc

(when using mmhc) compute Candidate Parent-and-Children sets instead of starting the Hill Climbing from an empty graph.

mandatory.edges

binary matrix, where a 1 in cell [i,j] indicates that an edge from node i to node j must be present in the final network.

Details

The other parameters available are the ones of learn.network, refer to the documentation of that function for more details. See also the documentation for learn.structure and learn.params for more informations.

Value

new BN object with structure (DAG) and conditional probabilities as learnt from the given dataset.

See Also

learn.network learn.structure learn.params

Examples

1
2
3
4
5
6
## Not run: 
mydataset <- BNDataset("data.file", "header.file")

net <- learn.dynamic.network(mydataset, num.time.steps=2)

## End(Not run)

tavazzie/bnstructScore documentation built on Dec. 23, 2021, 7:47 a.m.