buildCBN: Build a discrete Bayesian Network using climate data.

Description Usage Arguments Details Value Author(s) Examples

Description

Can be used to downscale discrete data to local scales by means of Bayesian Networks.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
buildCBN(data, structure.learning.algorithm = "tabu",
  structure.learning.args.list = list(),
  param.learning.method = "bayes", forbid.GG = FALSE,
  forbid.DD = FALSE, forbid.DtoG = FALSE, force.closest.GD = NULL,
  closest.GD.direction = NULL, forbid.GD = FALSE,
  structure.learning.steps = 1, fix.intermediate = TRUE,
  structure.learning.algorithm2 = NULL,
  structure.learning.args.list2 = list(), return.intermediate = FALSE,
  compile.junction = TRUE, parallelize = FALSE, n.cores = NULL,
  cluster.type = "FORK")

Arguments

data

Expects output from prepare_predictors.forBN.

structure.learning.algorithm

Algorithm used to perform structure learning, with name as text. Supports all the score-based, constraint-based and hybrid bayesian network structure learning algorithms from bnlearn. Refer to Details for a list of supported algorithms.

structure.learning.args.list

List of arguments passed to structure.learning.algorithm, in particular distance argument if local learning is used. Note that other arguments, e.g. whitelist, are an option (check the naming convention, see Details). Refer to bnlearn for the specific options.

param.learning.method

Either "bayes" or "mle", passed to learn the parameters for the Conditional Probability Tables for the built DAG data.

forbid.GG

If set to TRUE, arcs between grid or G nodes will be forbidden.

forbid.DD

If set to TRUE, arcs between local, i.e. station or D nodes, will be forbidden.

forbid.DtoG

If set to TRUE, arcs from D nodes to G nodes will be forbidden.

force.closest.GD

Expects a positive integer or NULL. If not NULL, each D node will be linked, see closest.GD.direction, with the n closest G node(s), where n is force.closest.GD.

closest.GD.direction

Either NULL, which lets the structure learning algorithm decide the direction, "up", which will place the arc(s) in the form D -> G, or "down", which will place the arc(s) in the form G -> D.

forbid.GD

If set to TRUE, arcs between G and D nodes will be forbidden. See Details.

structure.learning.steps

It is used to perform structure learning in two steps. Refer to Details.

  • 1 or NULL (Default) 1 step

  • 2 or c("local", "global") If dynamic = FALSE learn first a DAG for D nodes, then inject G nodes. If dynamic = TRUE it equals c("local-global", "past")

Note that only first two options are valid when dynamic = FALSE

fix.intermediate

Set to TRUE to forbid the creation of new arcs in the next steps for already built DAGs. See Details. structure.learning.algorithm2 and structure.learning.args.list2. See Details.

structure.learning.algorithm2

Same as structure.learning.algorithm for the second step if structure.learning.steps is employed. Ignored otherwise.

structure.learning.args.list2

Same as structure.learning.args.list for the second step if structure.learning.steps is employed. Ignored otherwise.

return.intermediate

Add the intermediate DAGs to the output, as $intermediateDBN1 and $intermediateDBN2 (if any) if structure.learning.steps is employed.

compile.junction

Compile the junction from BN.fit to compute probabilities. Can be set to FALSE, in which case it can still be computed if needed at the training stage, i.e. through downscale.BN().

parallelize

Set to TRUE for parallelization. Refer to the parallel and see Details.

n.cores

When parallelize = TRUE, number of threads to be used, will use detectCores()-1 if not set.

cluster.type

Either "PSOCK" or "FORK". Use the former under Windows systems, refer to parallel package.

Details

Structure Learning Algorithms Use structure.learning.algorithm to specify the algorithm for the structure (DAG) learning process. Currently it DOES NOT support local discovery algorithms, expect malfuncion if used. List of supported algorithms: "hc", "tabu" (score-based), "gs", "iamb", "fast.iamb", "inter.iamb" (constraint-based), "mmhc", "rsmax2" (hybrid). Check their corresponding parameters in bnlearn, arguments may be passed to the algorithm through the parameter structure.learning.args.list. Do not forget to set the distance argument in structure.learning.args.list for local learning.

Two or Three Step Learning

Forbidding or Forcing Arcs For non dynamic Bayesian Networks, i.e. when dynamic = FALSE (default), forbid.GG, forbid.DD, forbid.DtoG, force.closest.GD, forbid.GD, fix.intermediate, structure.learning.steps allow introducing constraints to the structure learning algorithm. The user might also combine them with structure.learning.args.list$whitelist and structure.learning.args.list$blacklist. As whitelist has priority over blacklist, i.e. an arc placed in both will always be present in the DAG, they provide maximum flexibility. Bearing the priority of the whitelist, force.closest.GD = TRUE and forbid.GD = TRUE will, for example, forbid the placement of aditional arcs beyond those specified as the closest G-D.

When manually specifying a whitelist or blacklist through structure.learning.args.list, beware of the naming convention. It overrides the names and marks them as either "D.X" or "G.X", preditand and predictor nodes, respectivelly. It is best to plot a dummy network using plotDBN() first.

Aditional details Parameters output.marginals and compile.junction are useful to save time if the user only intends to visualize the DAG.

Value

An object of type DBN which contains the learnt Bayesian Network.

Author(s)

Mikel N Legasa

Examples

1
2
# Not yet
# Loading predictors

MNLR/BNdownscaleR documentation built on June 12, 2019, 1:58 p.m.