The sa method KirkpatrickGelattVecchi1983FSinR starts with a certain set of features and in each iteration modifies an element of the previous feature vector and decreases the temperature. If the energy of the new feature vector is better than that of the old vector, it is accepted and moved towards it, otherwise it is moved towards the new vector according to an acceptance probability. The algorithm ends when the minimum temperature has been reached. Additionally, a number of internal iterations can be performed within each iteration of the algorithm. In this case, the same temperature value of the outer iteration is used for the inner iterations
sa(
data,
class,
featureSetEval,
start = sample(0:1, ncol(data) - 1, replace = TRUE),
temperature = 1,
temperature_min = 0.01,
reduction = 0.6,
innerIter = 1,
verbose = FALSE
)
A data frame with the features and the class of the examples
The name of the dependent variable
The measure for evaluate features
Binary vector with the set of initial features
Temperature initial
Temperature to stops in the outer loop
Temperature reduction in the outer loop
Number of iterations of inner loop. By default no inner iterations are established
Print the partial results in each iteration
A list is returned containing for each repetition of the algorithm:
A vector with all features. Selected features are marked with 1, unselected features are marked with 0
Evaluation measure obtained with the feature selection
The vector with which the algorithm started
The evaluation measure of the initial vector
Matrix with the results of each iteration. Contains the number of the iteration, the value of the temperature, the subset of features of the iteration, its evaluation measure and whether there has been a movement from the previous iteration to obtain the subset of features in the current iteration.
List containing as many lists as outer iterations have been performed. In each iteration of these lists the same values are shown as for traceOutter but referring to each internal iteration.
# NOT RUN {
## Simulated Annealing for iris dataset (filter method)
sa(iris, 'Species', roughsetConsistency, temperature = 5, temperature_min=0.01,
reduction=0.6, verbose=TRUE)
# }
Run the code above in your browser using DataLab