Description Usage Arguments Value Author(s) See Also Examples
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.
1 2 | evaluation(Pop, X, XtX = NULL, lambda, grad.control = list(tol.obj = 1e-06,
max.ite = 50), ncores = 1)
|
Pop |
Population of permutations from [1,p]: matrix with |
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
|
ncores |
Number of cores (>1, depending on your computer). |
A list with the following elements:
Tpop Matrix with pxp columns, each column corresponding to the best triangular matrix (in a vector form) associated to each permutation of the population.
f Fitness of the population.
A list with the following elements:
Tpop
Matrix with p rows and pop.size columns, each column corresponding to the best triangular matrix (in a vector form) associated to each permutation of the population.
f
Fitness of the population.
Magali Champion, Victor Picheny and Matthieu Vignes
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.