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 |
data |
a data frame used for learning the network, see
|
prior |
a list containing parameter priors, generated by
|
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
|
degree |
an integer, which gives the degree of perturbation, see
|
trylist |
a list used internally for reusing learning of nodes,
see |
trace |
a logical. If |
timetrace |
a logical. If |
showban |
a logical passed to the plot method for network
objects. If
|
removecycles |
a logical. If |
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 |
table |
a table with all tried
networks. If removecycles is |
trylist |
an updated list used internally for reusing learning
of nodes, see |
Author(s)
Susanne Gammelgaard Bottcher,
Claus Dethlefsen rpackage.deal@gmail.com.
See Also
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))