optimization.GA {alineR} | R Documentation |
Cognate pairs and their determined alignment generated in ALINE format is used to find a set of optimal parameters in terms of number of correctly aligned pairs. A genetic algorithm is executed. It is called in the optimize.features function and is the core function for the optimization part.
optimization.GA(Al, data, num, step = 5, plot = TRUE)
Al |
A 2*n matrix containing the correct alignment of the input |
data |
A 2*n matrix containing the pairs of words to be aligned |
num |
The size of initial population in the genetic algorithm |
step |
number of iterations for the genetic algorithm |
plot |
plot the convergence process of the algorithm |
R |
a list, containing |
performance |
The number of correctly aligned pairs |
optimized_parameters |
a matrix containing all the optimal parameters after the optimization |
data<-as.matrix(data.frame(dog=c('dog','perro'),cat=c('cat','gato'),rat=c('rat','rata'))) M<-generate.training(raw.data=data,search.size=100,table=FALSE) alignment<-rbind(M[[2]][4,],M[[2]][5,]) optimization.GA(Al=alignment,data=data,num=5,step=3,plot=FALSE)