Learn R Programming

deal (version 1.1-2)

learn: Learning networks and nodes

Description

Given a network and a dataframe and jointprior, the network parameters are updated to their posteriors.

Usage

learn (nw, df, prior=jointprior(nw),
                       nodelist=1:nw$n,trylist=
                       rep(list(NULL),nw$n),
                       timetrace=FALSE,smalldf=NA,
                       usetrylist = nw$n

Arguments

nw
The network.
df
Dataframe used for learning the network, see network.
prior
A joint prior, see jointprior.
nodelist
A vector of indices of nodes to be learned.
trylist
Used internally for reusing learning of nodes, see maketrylist.
smalldf
Used for analysing networks with time-varying nodes, see timeslice.
timetrace
If TRUE, prints some timing information on the screen.
node
Node to be learned.
usetrylist
Use trylist or not. If the number of nodes is large, the lookup in the trylist is slower than re-learning the node.

Value

  • A list with two elements
  • nwThe network with the condposterior attributes updated for the nodes. Also, the attribute score is updated and contains the network score. The contribution to the network score for each node is contained in the attribute loglik for each node.
  • trylistUpdated.

Details

Given data and a network, the parameters are updated. The joint prior defines the prior parameters by conditioning (see conditional) in the local master (see localmaster). The data are then learned by calling the approriate post function. A socalled trylist is maintained. This consists of learned nodes with particular parent configurations. If a node with a certain parent configuration needs to be learned, it is checked, whether the node has already been learned. The previously learned nodes are given as input in the trylist parameter and is updated in the learning procedure. The learning procedure calls reuselearn which traverses through the trylist to see if it is possible to reuse previously learned nodes. If it is not possible to reuse information, the posterior distributions of the parameters are calculated. First, the master prior procedure is used (conditional) to deduce the prior parameters for the current node. Then the posteriors are determined from the data using the algorithm described in Bottcher (2002). udisclik calculates the log-likelihood contribution of discrete nodes. For continuous nodes, this is done while learning. The learning procedure is called from various functions using the principle, that networks should always be updated with their score. Thus, eg. drawnetwork keeps the network updated when the graph is altered.

References

Further information about Deal can be found at: http://www.math.auc.dk/novo/deal.

See Also

networkfamily, jointprior, maketrylist, network, post

Examples

Run this code
data(rats)
fit       <- network(rats)
fit.prior <- jointprior(fit,12)
fit       <- learn(fit,rats,fit.prior)$nw

Run the code above in your browser using DataLab