NeticaBN {RNetica}R Documentation

An object referencing a Bayesian network in Netica.

Description

This file is now obsolete: See NeticaBN for the new class description.

This object is returned by various RNetica functions which create or find network objects, and contain handles to the Bayesian network. A NeticaBN object represents an active network. The function is.active() tests whether the network is still loaded into Netica's memory.

Usage

is.NeticaBN(x)

Arguments

x

The object to print or test

Details

This is an object of class NeticaBN. It consists of a name, and an invisible handle to a Netica network. The function is.active() tests the state of that handle and returns FALSE if the network is no longer in active memory (usually because of a call to DeleteNetwork()). The printed representation depends on whether or not it is active (inactive nodes print as "<Deleted Network: Name >").

For active networks, the equality test tests to see if both object point to the same object in Netica memory. Not that the name of the network is embedded in the object implementation and may get out of sync with the network, so the printed representations may be unequal even if it points to the same network. For inactive networks, the objects are compared using the cached names.

Value

For toString() a string. The function print() is usually called for its side effects.

The function is.NeticaBN() returns a logical scalar depending on whether or not its argument is a NeticaBN.

The function Ops.NeticaBN() returns a logical value depending on whether the objects are equal.

Note

[This reflects RNetica version 0.1–0.4. It is no longer current as of version 0.5.]

Internally, the NeticaBN objects are character strings with extra attributes. So as.character(net) will return the name of the network. Because of this, the default c() function will strip off the essential attributes returning them to strings. Use the cc() function instead to avoid this problem.

Note that if a NeticaBN object is stored in an R object, and the network is subsequently renamed (with a call to the set method of NetworkName), the old object may persist with the wrong name. This may result in a situation where the printed names of the objects are different but net1==net2 returns true. This can be fixed with the code NetworkName(net) <- NetworkName(net).

NeticaBN objects are all rendered inactive when StopNetica() is called, therefore they do not persist across R sessions. Generally speaking, the network should be saved, using WriteNetworks() and then reloaded in the new session using ReadNetworks(). When a network is saved or loaded the "Filename" attribute is set, to provide a mechanism for storing the filename across R sessions.

Author(s)

Russell Almond

References

http://norsys.com/onLineAPIurl/index.html: GetNetUserData_bn(), SetNetUserData_bn() (these are used to maintain the back pointers to the R object).

See Also

CreateNetwork(),DeleteNetwork(), GetNamedNetworks(),NetworkName(), is.active(), NetworkAllNodes(), WriteNetworks(), GetNetworkFileName(), cc()

Examples

## Not run: 
net1 <- CreateNetwork("aNet")
stopifnot(is.NeticaBN(net1))
stopifnot(is.active(net1))
stopifnot(net1$Name=="aNet")

net2 <- GetNamedNetworks("aNet")
stopifnot(net2$Name=="aNet")
stopifnot(net1==net2)

NetworkName(net1) <- "Unused"
stopifnot(net1==net2)

netd <- DeleteNetwork(net1)
stopifnot(!is.active(net1))
stopifnot(!is.active(net2))
stopifnot(netd$Name=="Unused")
stopifnot(netd == net1)
## Warning:  The following expression used to not be true (RNetica <0.5)
## but now is.
net1 = net2


## End(Not run)

[Package RNetica version 0.5-4 Index]