Description Usage Arguments Details Value Note Author(s) References See Also Examples
Uses a genetic algorithm for network search. Combines selection of best models, crossing over of nodes and connected edges between pairs of nodes and mutation of edges to sample the search space.
1 2 3 4 5 6 | netga(dat, stimuli, P=NULL, maxiterations=1000, p=100,
q=0.3, m=0.8, hmmiterations=30, multicores=FALSE, usebics=FALSE,
cores=2, lambda=NULL, B=NULL, Z=NULL, scorefile=NULL, fanin = 4,
gam=NULL,it=NULL,K=NULL,quantL=.5,quantBIC=.5,priortype="none",
plotresults=TRUE, scale_lik=FALSE, allow.stim.off=TRUE,
debug=0,retobj=NULL, implementation="C")
|
dat |
The data matrix. See |
stimuli |
The list of stimuli. See |
P |
A list containing a population of network models. If NULL, an initial population of networks is sampled including the empty and fully connected network. |
maxiterations |
Integer, maximal number of generations. |
p |
The size of the population. Used only if P is not provided. |
q |
Double \in [0;1]. The rate of selection or crossing over. At most (1-q) \cdot |P| nodes are selected to persist into the next generation, but only if the fitness score is more optimal than the median of scores in the population. If less than (1-q)*|P| fulfill this criterion, the number q \cdot |P| of crossing overs is increased accordingly. |
m |
Double \in [0;1]. The mutation rate - m \cdot |P| networks out of the Population are mutated after selection and crossing over. Mutations happen for edges and change the type of the edge randomly. |
hmmiterations |
Maximum number of iterations during the HMM. |
multicores |
Use multiple processors. |
usebics |
Use BIC statistic for model selection. |
cores |
Number of cores to use in case of |
lambda |
The Prior influence strength in the laplace prior. |
B |
The Prior information matrix. Corresponds to prior edge probabilities in the final network. |
Z |
The normalisation factor for the prior distribution. |
fanin |
Integer: maximal indegree for nodes. |
gam |
Prior influence strength in scalefree prior. Used as exponent in |
it |
Number of iterations to generate background distribution in scalefree prior. |
K |
Proportionality factor in scalefree prior |
quantL |
Quantile of Population likelihood. Defines the selection threshold in |
quantBIC |
Quantile of Population likelihood. Defines the selection threshold in |
scorefile |
Name of pdf-file where intermediate traces of the BIC, the differences of BICs in two succeeding generations and a comparison of optimum and average fitness are drawn. If NULL, the plot is drawn on the standard device for plotting. |
priortype |
Character. One of |
plotresults |
Boolean. If TRUE, some statistics are plotted while netga is running. |
scale_lik |
Boolean. Perform scaling of the likelihood according to how many data points were used to calculate the overall likelihood. |
allow.stim.off |
Boolean. If TRUE, the stimulus can become passive at some time. This will generate additional reachable system states, in particular all states from the normal state matrix, generated by the propagation, but with the stimulus node set to 0. |
debug |
Numeric. If 0, a status bar indicates the progress of the algorithm. If 1 or 2,
extra information is printed to the console (for |
retobj |
List. The output generated during a GA run (see function |
implementation |
String. One of |
Usually this function is called internally by ddepn
.
A list containing the following objects:
A list named P
holding the model objects for each candidate network in the population. Each
entry in the list contains the following elements:
phi |
Adjacency matrix. The inferred network. |
L |
Likelihood. |
aic |
Akaikes Information Criterion. |
bic |
Bayesian Information Criterion. |
posterior |
Posterior probability. Only present if |
dat |
The data matrix. |
theta |
The parameter matrix for the Gaussians. |
gamma |
The state transition matrix. |
gammaposs |
The theoretical state transition matrix, as generated by the effect propagation. |
tps |
A list. Each element is a vector of time points for each experiment in the data matrix. |
stimuli |
List of stimuli. |
reps |
Number of replicates for each experiment. |
hmmiterations |
Maximum number of iterations during an HMM run. |
lastmove |
String. Type of the last change that was performed. |
coords |
Position in the network where the last change was performed. |
lambda |
Laplace prior hyperparameter. |
B |
The Prior information matrix. See |
Z |
Laplace prior normalisation factor. (Not used at the moment.) |
fanin |
Maximal indegree for nodes. |
gam |
Sparsity prior hyperparameter. |
it |
Sparsity prior iterations. |
K |
Sparsity prior scaling factor. |
priortype |
The prior that was used. |
A matrix named scorestats
holding in each column the traces of the following statistics,
each row corresponds to one iteration:
dL_total |
Median of total Likelihood change. |
dP_total |
Median of total Prior change. |
dL_crossover |
Median of Likelihood change for crossover. |
dL_mutation |
Median of Likelihood change for mutation. |
dP_crossover |
Median of Prior change for crossover. |
dP_mutation |
Median of Prior change for mutation. |
dL_total_abs |
As above, but absolute values. |
dP_total_abs |
As above, but absolute values. |
dL_crossover_abs |
As above, but absolute values. |
dL_mutation_abs |
As above, but absolute values. |
dP_crossover_abs |
As above, but absolute values. |
dP_mutation_abs |
As above, but absolute values. |
score |
Trace of the total median score. The score depends on the type of inference, if
|
TODO
Christian Bender
TODO
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ## Not run:
## load package
library(ddepn)
## sample a network
n <- 6
signet <- signalnetwork(n=n, nstim=2, cstim=0, prop.inh=0.2)
phit <- signet$phi
stimuli <- signet$stimuli
## sample data
dataset <- makedata(phit, stimuli, mu.bg=1200, sd.bg=400, mu.signal.a=2000, sd.signal.a=1000)
## now the GA
ret <- netga(dataset$dat, stimuli, P=NULL, maxiterations=30, p=15,
q=0.3, m=0.8, hmmiterations=100, multicores=FALSE, usebics=TRUE, cores=1,
lambda=NULL, B=NULL, scorefile=NULL, priortype="none")
## now the GA with prior
## use original network as prior matrix
## reset all entries for inhibiting edges
## to -1
B <- phit
B[B==2] <- -1
ret <- netga(dataset$dat, stimuli, P=NULL, maxiterations=30, p=15,
q=0.3, m=0.8, hmmiterations=100, multicores=FALSE, usebics=FALSE, cores=1,
lambda=0.01, B=B, scorefile=NULL, priortype="laplaceinhib")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.