Learn R Programming

deal (version 1.1-15)

learn: Estimates the parameters in the local probability distributions from data

Description

Update the distributions of the parameters in the network, based on a prior network and data. Also, the network score is calculated.

Usage

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

udisclik(node,nw,df)

reuselearn(node,trylist)

Arguments

nw
The network.
df
Data frame 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.
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 look up in the trylist may be 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

The procedure learn determines the master prior, local parameter priors and local parameter posteriors. It may be called on all nodes or just a single node. From the joint prior distribution, the marginal distribution of all parameters in the family consisting of the node and its parents can be determined. This is the master prior, see localmaster. The local parameter priors are now determined by conditioning in the master prior distribution, see conditional. The hyperparameters associated with the local parameter prior distribution is attached to each node in the attribute condprior. Finally, the local parameter posterior distributions are calculated (see post) and attached to each node in the attribute condposterior. A so-called trylist is maintained. It 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. When one or more nodes in a network have been learned, the network score is updated and attached to the network in the attribute score. The learning procedure is called from various functions using the principle, that networks should always be updated with their score. Thus, e.g. 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