autosearchEx {BNArray}R Documentation

Greedy search

Description

From initial network, does local perturbations to increase network score.

Usage

autosearchEx(initnw,data,prior=jointprior(network(data)),maxiter=50,
           trylist= vector("list",size(initnw)),trace=TRUE,
           timetrace=TRUE,showban=FALSE,removecycles=FALSE) 

heuristicEx(initnw,data,prior=jointprior(network(data)),
          maxiter=100,restart=10,degree=size(initnw),
          trylist= vector("list",size(initnw)),trace=TRUE,
          timetrace=TRUE,removecycles=FALSE)

Arguments

initnw an object of class network, from which the search is started.
data a data frame used for learning the network, see network.
prior a list containing parameter priors, generated by jointprior.
maxiter an integer, which gives the maximum number of steps in the search algorithm.
restart an integer, which gives the number of times to perturb initnw and rerun the search.
degree an integer, which gives the degree of perturbation, see \perturb.
trylist a list used internally for reusing learning of nodes, see maketrylist.
trace a logical. If TRUE, plots the accepted networks during search.
timetrace a logical. If TRUE, prints some timing information on the screen.
showban a logical passed to the plot method for network objects. If FALSE, the banned arrows are not shown in the plots (if trace is TRUE).
removecycles a logical. If TRUE, all networks explored in the search is returned, except for networks containing a cycle. If FALSE, all networks are returned, including cyclic networks.
x an output object from a search.

Details

In autosearchEx, a list of networks is in each step created with either one arrow added, one arrow deleted or one arrow turned (if a cycle is not generated). The network scores of all the proposal networks are calculated and the network with the highest score is chosen for the next step in the search. If no proposed network has a higher network score than the previous network, the search is terminated. The network with the highest network score is returned, along with a list containing all tried networks (depending on the value of removecycles).

heuristicEx restarts by perturbing initnw degree times and calling autosearchEx again. The number of restarts is given by the option restart.

Value

autosearchEx and heuristicEx returns a list with three elements, that may be accessed using getnetwork, gettable and gettrylist. The elements are

nw an object of class network, which gives the network with the highest score.
table a table with all tried networks. If removecycles is FALSE, the networks may contain cycles. The table contains two columns: model with a string representation of the model and score with the corresponding log network score. The table can be translated to a networkfamily using makenw.
trylist an updated list used internally for reusing learning of nodes, see maketrylist.

Author(s)

Susanne Gammelgaard Bé´—tcher alma@math.aau.dk,
Claus Dethlefsen aas.claus.dethlefsen@nja.dk
Xiaohui Chen cxh1984@interchange.ubc.ca,
Kaida Ning aprilnkd@hotmail.com,
Ming Chen mchen@zju.edu.cn.

References

Further information about BNArray can be found at:
http://www.math.aau.dk/~dethlef/novo/deal
http://www.cls.zju.edu.cn/binfo/BNArray.

See Also

perturb

Examples

## Not run: 
        library(BNArray)
        data(total.data)
        setwd("/home")  #for linux user

##SHOULD call LLSimpute first
ori.compact<-LLSimpute(total.data$df.all,total.data$df.ori,total.data$n.changed)

##Imputing the too bad missing values
ori.compact<-FinalImpute(ori.compact)

##Prepare readily used complete database for constructing Bayesian network
bn.data<-PrepareCompData(ori.compact)
n.microarray<-dim(ori.compact)[2]

##Do Bayesian network construction
##select a subset genes to be modeled
selected.gene<-c(10:15)
bn.data<-bn.data[1:(n.microarray-1),selected.gene]
nw<-network(bn.data)

##specify a prior network
nw.prior<-jointprior(nw,20)
nw<-getnetwork(learn(nw,bn.data,nw.prior))

##perform greedy search
nw.search<-autosearchEx(nw,bn.data,nw.prior,removecycles=TRUE)

##perturb initial network nw with random restarts to avoid local maximum
nw.heu<-heuristicEx(getnetwork(nw.search),bn.data,nw.prior,removecycles=TRUE,restart=2,degree=10,trylist=gettrylist(nw.search))

##highest score network
nw.best<-getnetwork(nw.heu)
plot(nw.best,cexscale=3,unitscale=5)
## End(Not run)

[Package BNArray version 1.0 Index]