loadNetwork: Load a Bayesian network

Description Usage Arguments Details Value Note Examples

View source: R/loadNetwork.R

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

1
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.

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.

Value

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

Note

Under current release, this function wraps a set of hidden functions copied in block from the gRain package, as current CRAN policy discourages accessing hidden functions with the ":::" operator. These functions will be progressively substituted by bnspatial native ones.

Examples

1
2
3
4
5
6
## Load from external file (.net format)
raw = system.file("extdata/LandUseChange.net", package = "bnspatial")
loadNetwork(raw)

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

Example output

Independence network: Compiled: FALSE Propagated: FALSE 
  Nodes: chr [1:8] "CurrentLULC" "LegalStatus" "Slope" "Stakeholders" "Scenarios" ...
Independence network: Compiled: TRUE Propagated: TRUE 
  Nodes: chr [1:8] "CurrentLULC" "LegalStatus" "Slope" "Stakeholders" "Scenarios" ...

bnspatial documentation built on Jan. 17, 2020, 9:06 a.m.