autosearch {deal}R Documentation

Greedy search

Description

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

Usage

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

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

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 autosearch, 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).

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

Value

autosearch and heuristic 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 Bottcher,
Claus Dethlefsen rpackage.deal@gmail.com.

See Also

perturb

Examples

data(rats)
fit       <- network(rats)
fit.prior <- jointprior(fit,12)
fit       <- getnetwork(learn(fit,rats,fit.prior))
fit       <- getnetwork(insert(fit,2,1,rats,fit.prior))
fit       <- getnetwork(insert(fit,1,3,rats,fit.prior))
hisc      <- autosearch(fit,rats,fit.prior,trace=FALSE)
hisc      <- autosearch(fit,rats,fit.prior,trace=FALSE,removecycles=TRUE) # slower
plot(getnetwork(hisc))

hisc2     <- heuristic(fit,rats,fit.prior,restart=10,trace=FALSE)
plot(getnetwork(hisc2))
print(modelstring(getnetwork(hisc2)))
plot(makenw(gettable(hisc2),fit))

[Package deal version 1.2-42 Index]