GADAG2_Analyze: Analyze GADAG2 results.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/GADAG2_Analyze.R

Description

Function to Analyze GADAG2 results.

Usage

1
2
3
GADAG2_Analyze(Results, G = NULL, X = NULL,
  plot.control = list(plot.graph = 0, plot.evol = 0, plot.png = 0),
  Nodes = NULL)

Arguments

Results

Outputs from GADAG2_Run() function.

G

(optional) Adjacency matrix corresponding to the true DAG (pxp matrix).

X

(optional) Design matrix with samples (n) in rows and variables (p) in columns.

plot.control

A list containing parameters to control the produced graph outputs (return.level has to be turned to 1 in the main code beforehand):

  • plot.graph If 1, generates the figures with the actual and estimated graphs,

  • plot.evol If 1, generates the figures showing the evolution of the genetic algorithm (fitness value, Shannon entropy and best node ordering),

  • plot.png If 1, saves the figures in .png.

Nodes

(optional) If plot.evol is turned on, specifies the evolution of which nodes you want to highlight.

Details

This function returns as primary outputs the performances of the estimation graph procedure in terms of TP, FP, FN, TN, precision and recall, obtained by comparing the estimated graph with the true one (if known and provided). If specified (plot.graph, plot.evol), the user can plot both the estimated graph and the true DAG (if known and provided) and the evolution of the algorithm. This generates three figures: the first one represents the evolution of the fitness value (best fitness in red, averaged population fitness and quantiles across the iterations), the second one, the evolution of the Shannon entropy of each node across the iterations, the third one, the best node ordering (permutation that minimizes the fitness) across the iterations.

Value

A vector containing the scores of precision, recall, number of false positives (FP), false negatives (FN), true positives (TP), true negatives (TN) and mean squared error (only if G and X are provided).

Author(s)

Magali Champion, Victor Picheny and Matthieu Vignes

See Also

GADAG2, GADAG2_CV, GADAG2_Run, GADAG2_Analyze.

Examples

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 #############################################################
 # Loading toy data
 #############################################################
 data(toy_data)
 # toy_data is a list of two matrices corresponding to a "star"
 # DAG (node 1 activates all other nodes):
 # - toy_data$X is a 100x10 design matrix
 # - toy_data$G is the 10x10 adjacency matrix (ground trough)

 ########################################################
 # Evaluating GADAG2 Results
 ########################################################
 # simple run, where you only get the precision, recall, number
 # of false positives, true positives, false negatives, true negatives
 # and mean squared error of the estimated graph

 # run GADAG2 with the predefined parameters
 GADAG2_results <- GADAG2_Run(X=toy_data$X, lambda=0.1)

 # analyze the results
 GADAG2_analysis <- GADAG2_Analyze(GADAG2_results, G=toy_data$G, X=toy_data$X)
 print(GADAG2_analysis) # here are the results

 # more complex run, where you want to have some details about the procedure
 ## Not run: 
 # run GADAG2 with return.level set to 1 beforehand
 GADAG2_results <- GADAG2_Run(X=toy_data$X, lambda=0.1,return.level=1)

 # print the evolution of the algorithm and highlight node 1
 plot.evol <- 1
 GADAG2_analysis <- GADAG2_Analyze(GADAG2_results, G=toy_data$G, X=toy_data$X,
          plot.control = list(plot.evol=1), Nodes=c(1))

 # in addition, print the estimated and the true graph
 plot.graph <- 1
 GADAG2_analysis <- GADAG2_Analyze(GADAG2_results, G=toy_data$G, X=toy_data$X,
          plot.control = list(plot.evol=plot.evol, plot.graph= plot.graph))

 # now save the results in .png, but only for the graphs
 plot.png <- 1
 GADAG2_analysis <- GADAG2_Analyze(GADAG2_results, G=toy_data$G, X=toy_data$X,
          plot.control = list(plot.graph= plot.graph, plot.png = plot.png))

 # in case you don't know the true DAG, you can't really know how good the
 # estimation is. You can't compute the precision, recall, MSE but you can
 # still plot the estimated graph and see the evolution of the algorithm
 plot.graph <- plot.evol <- 1
 plot.png <- 0
 GADAG2_analysis <- GADAG2_Analyze(GADAG2_results, X=toy_data$X,
          plot.control = list(plot.graph= plot.graph, plot.evol = plot.evol))
 
## End(Not run)

magalichampion/GADAG documentation built on May 21, 2019, 11:04 a.m.