genetic( mat, kmin, kmax = kmin, popsize = 100, nger = 20,
mutate = FALSE, maxclone = 5, exclude = NULL, include = NULL,
improvement = TRUE, printfile = FALSE,
iseed = c(sample(0:4095,3),sample(0:2047,1)*2+1), criterion = "RM",
pcindices = 1:kmax)
improve
).rm.coef
,
gcd.coef
).improve
). The parents
and offspring are ranked according to their criterion value, and the
best popsize of these k-subsets will make up the next
generation, which is used as the current population in the subsequent iteration.The stopping rule for the algorithm is the number of generations (nger).
Optionally, the best k-variable subset produced by the Genetic Algorithm may be passed as input to a restricted local search algorithm, for possible further improvement.
The user may force variables to be included and/or excluded from the k-subsets.
For each cardinality k, the total number of calls to the procedure which computes the criterion values is $popsize + nger$ x $popsize/2$. These calls are the dominant computational effort in each iteration of the algorithm.
In order to improve computation times, the bulk of computations are
carried out by a Fortran routine which is called by this
function. Further details about the Genetic Algorithm can
be found in Reference 1 and in the comments to the Fortran code (in
the src
subdirectory for this package). For p > 300, it is
necessary to change the declarative statements in the Fortran code.
2) Cadima, J. and Jolliffe, I.T. (2001). Variable Selection and the Interpretation of Principal Subspaces, Journal of Agricultural, Biological and Environmental Statistics, Vol. 6, 62-79.
rm.coef
, rv.coef
,
gcd.coef
, anneal
, improve
.data(swiss)
genetic(cor(swiss),3,4,popsize=10,nger=5,iseed=c(2345,3276,1568,3187),criterion="Rv")
## For cardinality k= 4
## Generation number 4 does not
## have sufficient genetic diversity
## for acceptable levels of consanguinity
## (couples differing by at least 2 genes).
##
## This situation may be overcome by
## reducing the maximum acceptable number
## of clones (maxclone).
##
##
## Best criterion value found so far: 0.955714479
##
## $subsets
## Var.1 Var.2 Var.3
## Solution 1 1 2 3
## Solution 2 1 2 5
## Solution 3 3 4 6
## Solution 4 1 4 5
## Solution 5 3 4 5
## Solution 6 3 4 5
## Solution 7 3 4 5
## Solution 8 2 4 5
## Solution 9 1 3 4
## Solution 10 1 3 4
##
## $values
## Solution 1 Solution 2 Solution 3 Solution 4 Solution 5 Solution 6
## 0.9141995 0.9098502 0.9034868 0.9023910 0.9020271 0.9020271
## Solution 7 Solution 8 Solution 9 Solution 10
## 0.9020271 0.8982510 0.8940945 0.8940945
##
## $bestvalues
## Card.3
## 0.9141995
##
## $bestsets
## Var.1 Var.2 Var.3
## 1 2 3
##
Run the code above in your browser using DataLab