Description Usage Arguments Details Value Author(s) References See Also Examples
A set of functions implementing simple variable selection in classification applications using simulated annealing
| 1 2 3 4 5 6 | 
| x | Data matrix: independent variables used by  | 
| response | Class vector, used by  | 
| eval.fun | evaluation function. Should take a data matrix, a class vector (or factor), and a subset argument | 
| Tinit | Initial temperature | 
| niter | Maximal number of iterations | 
| cooling | Cooling speed | 
| fraction | Size of the desired subset, as a fraction of the total number of variables | 
| ... | Further arguments to the evaluation function | 
| curr.set | Current trial solution | 
| maxvar | The total number of variables to choose from | 
| size.dev | Parameter governing the variability in size of subsequent subsets | 
Simulated Annealing (SA) starts with a random subset, and
proceeds by random moves in the solution space. In this
implementation, a new solution may deviate in length at most
size.dev variables: at most two variables may be swapped in or
out at each step. If a step is an improvement, it is unconditionally
accepted. If not, acceptance is a stochastic process depending on the
current temperature - with high temperatures, "bad" moves are more
likely to be accepted than with low temperatures. The process stops
after a predefined number of iterations.
Functions SAfun and SAfun2 both return a list
containing the following fields:
| best | The best subset | 
| best.q | The quality of the best subset | 
In addition, the outcome of SAfun2 also contains
| qualities | A vector containing quality values of solutions seen throughout the optimization | 
| accepts | A vector containing logicals indicating which solutions were accepted and which were rejected | 
Ron Wehrens
R. Wehrens. "Chemometrics with R - Multivariate Data Analysis in the Natural Sciences and Life Sciences". Springer, Heidelberg, 2011.
| 1 2 3 4 5 6 7 8 9 10 | if (require("pls")) {
data(gasoline, package = "pls")
## usually more than 50 iterations are needed
SAobj <- SAfun(gasoline$NIR, gasoline$octane,
               eval.fun = pls.cvfun, Tinit = 3,
               fraction = .02, niter = 50, ncomp = 2)
SAobj
} else {
  cat("Package pls not available.\nInstall it by typing 'install.packages(\"pls\")'")
}
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.