Learn R Programming

bnspatial (version 1.1.1)

loadNetwork: Load a Bayesian network

Description

This function loads the Bayesian network from a native gRain object of class grain or an external file with extension .net (as provided by external softwares Hugin or GeNIe), optionally compiling the network.

Usage

loadNetwork(network, target = NULL)

Arguments

network

The Bayesian network. An object of class grain, or a character (the path to the .net file to be loaded)

target

character. The node of interest to be modelled and mapped.

Value

An object of class grain. The Bayesian network. If target argument is provided the network is compiled for a faster querying .

Details

Bayesian networks built with the package bnlearn can be imported with the function bnlearn::as.grain, which converts them into grain objects. .net file format as provided from Netica 5.24 currently does not correspond to a valid Hugin .net file. Argument target has default set to NULL, but if provided the network will be compiled for faster querying.

Examples

Run this code
# NOT RUN {
## Load from external file (.net format)
raw = system.file("extdata/LandUseChange.net", package = "bnspatial")
loadNetwork(raw)

## Compile using target node
loadNetwork(raw, 'FinalLULC')
# }

Run the code above in your browser using DataLab