evaluation: Evaluate the fitness of a population

Description Usage Arguments Value Author(s) See Also Examples

View source: R/evaluation.R

Description

Internal function of the genetic algorithm that evaluates the fitness (penalized log-likelihood) of a set (population) of permutations. It internally computes the best triangular matrix associated to each permutation of the population.

Usage

1
2
evaluation(Pop, X, XtX = NULL, lambda, grad.control = list(tol.obj = 1e-06,
  max.ite = 50), ncores = 1)

Arguments

Pop

Population of permutations from [1,p]: matrix with pop.size rows and p columns, each row corresponding to one permutation of the population.

X

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

XtX

(optional) Cross-product of X; computed if not provided.

lambda

Parameter of penalization (>0).

grad.control

A list containing the parameters for controlling the inner optimization, i.e. the gradient descent

  • tol.obj.inner tolerance (>0),

  • max.ite.inner maximum number of iterations (>0).

ncores

Number of cores (>1, depending on your computer).

Value

A list with the following elements:

A list with the following elements:

Author(s)

Magali Champion, Victor Picheny and Matthieu Vignes

See Also

GADAG, GADAG_Run, fitness.

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
 #############################################################
 # 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)

 ########################################################
 # Creating a population of permutations
 ########################################################
 # first, define the parameters
 p <- ncol(toy_data$G) # number of nodes
 pop.size <- 10 # population size

 # then create your population of permutations
 Pop <- matrix(data = 0, nrow = pop.size, ncol = p)
 for(i in 1:pop.size){
     Pop[i,] = sample(p)
 }

 ########################################################
 # Evaluating the fitness of the population
 ########################################################
 # evaluation of the whole population
 Evaluation <- evaluation(Pop=Pop,X=toy_data$X,lambda=0.1)
 print(Evaluation$f) # here is the fitness of the whole population

 # evaluation of one of the permutation
 Perm <- Pop[1,]
 Evaluation <- evaluation(Pop=Perm,toy_data$X,lambda=0.1)

 # optimal matrix T associated to Perm:
 T <- matrix(Evaluation$Tpop,p,p)

GADAG documentation built on May 2, 2019, 3:25 p.m.