找回密码
 注册
查看: 5833|回复: 0

请教R中 遗传算法包的选择

[复制链接]
发表于 2012-4-11 11:42:36 | 显示全部楼层 |阅读模式
大家好,我想用遗传算法寻找基因barcode,数据是SNP,0,1,2编码
R中有5个应用GA的包,相关的code如下,

1 GALGO:microarry data

2 genalg
Usage
rbga(stringMin=c(), stringMax=c(),
suggestions=NULL,
popSize=200, iters=100,
mutationChance=NA,
elitism=NA,
monitorFunc=NULL, evalFunc=NULL,
showSettings=FALSE, verbose=FALSE)
genalg包中,rbga()函数利用遗传算法实现多维函数的最优化。
rbga(stringMin=c(), stringMax=c(),
suggestions=NULL,
popSize=200, iters=100,
mutationChance=NA,
elitism=NA,
monitorFunc=NULL, evalFunc=NULL,
showSettings=FALSE, verbose=FALSE)
Arguments
stringMin vector with minimum values for each gene.
stringMax vector with maximum values for each gene.
suggestions optional list of suggested chromosomes
popSize the population size.
iters the number of iterations.
mutationChance the chance that a gene in the chromosome mutates. By default 1/(size+1). It affects
the convergence rate and the probing of search space: a low chance results
in quicker convergence, while a high chance increases the span of the search
space.
elitism the number of chromosomes that are kept into the next generation. By default is
about 20% of the population size.
monitorFunc Method run after each generation to allow monitoring of the optimization
evalFunc User supplied method to calculate the evaluation function for the given chromosome
showSettings if true the settings will be printed to screen. By default False.
verbose if true the algorithm will be more verbose. By default False.
3 mcga
Usage
mcga(popsize, chsize, crossprob = 1.0, mutateprob = 0.01, elitism = 1, minval, maxval, maxiter = 10, evalFunc)
Arguments
popsize Number of chromosomes.
chsize Number of parameters.
crossprob Crossover probability. By default it is 1.0
mutateprob Mutation probability. By default it is 0.01
elitism Number of best chromosomes to be copied directly into next generation. By
default it is 1
minval The lower bound of the randomized initial population. This is not a constraint
for parameters.
maxval The upper bound of the randomized initial population. This is not a constraint
for parameters.
maxiter The maximum number of generations. By default it is 10
evalFunc An R function. By default, each problem is a minimization.
4 rgenoud
rgenoud包中,genoud()函数将遗传算法和衍生的拟牛顿算法结合起来,可以求解复杂函数的最小(大)化问题。(http://cran.r-project.org/web/packages/rgenoud/index.html
genoud(fn, nvars, max=FALSE, pop.size=1000, max.generations=100, wait.generations=10,
hard.generation.limit=TRUE, starting.values=NULL, MemoryMatrix=TRUE,
Domains=NULL, default.domains=10, solution.tolerance=0.001,
gr=NULL, boundary.enforcement=0, lexical=FALSE, gradient.check=TRUE, data.type.int=FALSE, hessian=FALSE, unif.seed=812821, int.seed=53058,
print.level=2, share.type=0, instance.number=0,
output.path="stdout", output.append=FALSE, project.path=NULL,
P1=50, P2=50, P3=50, P4=50, P5=50, P6=50, P7=50, P8=50, P9=0,
P9mix=NULL, BFGSburnin=0, BFGSfn=NULL, BFGShelp=NULL,
control=list(), optim.method=ifelse(boundary.enforcement < 2, "BFGS", transform=FALSE, debug=FALSE, cluster=FALSE, balance=FALSE, ...)
5. genetic {subselect}

genetic( mat, kmin, kmax = kmin, popsize = 100, nger = 100,
mutate = FALSE, mutprob = 0.01, maxclone = 5, exclude = NULL,
include = NULL, improvement = TRUE, setseed= FALSE, criterion = "RM",
pcindices = 1:kmax, initialpop=NULL )
Arguments
mat        a covariance or correlation matrix of the variables from which the k-subset is to be selected.
kmin        the cardinality of the smallest subset that is wanted.
kmax        the cardinality of the largest subset that is wanted.
popsize        integer variable indicating the size of the population.
nger        integer variable giving the number of generations for which the genetic algorithm will run.
mutate        logical variable indicating whether each child undergoes a mutation, with probability mutprob. By default, FALSE.
mutprob        variable giving the probability of each child undergoing a mutation, if mutate is TRUE. By default, 0.01. High values slow down the algorithm considerably and tend to replicate the same solution.
maxclone        integer variable specifying the maximum number of identical replicates (clones) of individuals that is acceptable in the population. Serves to ensure that the population has sufficient genetic diversity, which is necessary to enable the algorithm to complete the specified number of generations. However, even maxclone=0 does not guarantee that there are no repetitions: only the offspring of couples are tested for clones. If any such clones are rejected, they are replaced by a k-variable subset chosen at random, without any further clone tests.
exclude        a vector of variables (referenced by their row/column numbers in matrix mat) that are to be forcibly excluded from the subsets.
include        a vector of variables (referenced by their row/column numbers in matrix mat) that are to be forcibly included in the subsets.
improvement        a logical variable indicating whether or not the best final subset (for each cardinality) is to be passed as input to a local improvement algorithm (see functionimprove).

setseed        logical variable indicating whether to fix an initial seed for the random number generator, which will be re-used in future calls to this function whenever setseed is again set to TRUE.
criterion        Character variable, which indicates which criterion is to be used in judging the quality of the subsets. Currently, only the RM, RV and GCD criteria are supported, and referenced as "RM", "RV" or "GCD" (see References, rm.coef, rv.coef and gcd.coef for further details).

pcindices        a vector of ranks of Principal Components that are to be used for comparison with the variable subsets (for the GCD criterion only, see gcd.coef).

initialpop        vector, matrix or 3-d array of initial population for the genetic algorithm. If a single cardinality is required, initialpop may be a popsize x k matrix or a popsize xk x 1 array (as produced by the $subsets output value of any of the algorithm functions anneal, genetic, or improve). If more than one cardinality is requested,initialpop must be a popsize x kmax x length(kmin:kmax) 3-d array (as produced by the $subsets output value).
If the exclude and/or include options are used, initialpop must also respect those requirements.

我的数据应该选择哪一种方法呢?

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-25 12:13 , Processed in 0.021779 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表