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 (from package bnlearn), or a character (the path to the .net file to be imported)

target

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

Details

Bayesian networks from the package bnlearn can be imported via the function as.grain, from package gRain.
.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')

bnspatial documentation built on Nov. 18, 2017, 4:13 a.m.