1 | monitor(obj)
|
obj |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (obj)
{
minEval = min(obj$evaluations)
filter = obj$evaluations == minEval
bestObjectCount = sum(rep(1, obj$popSize)[filter])
if (bestObjectCount > 1) {
bestSolution = obj$population[filter, ][1, ]
}
else {
bestSolution = obj$population[filter, ]
}
outputBest = paste(obj$iter, " #selected=", sum(bestSolution),
" Best (Error=", minEval, "): ", sep = "")
selected = as.logical(bestSolution)
out.col = which(names(data) == output)
selected = paste(names(data[, -out.col][, selected]), collapse = ", ")
outputBest = paste(outputBest, selected, "\n")
cat(outputBest)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.