library(eegAnalysis)
### Simulating some features
# number of features
n.features = 150
# number of replications of class A
n.classA = 200
# number of replications of class B
n.classB = 250
# initializing the features data frame
features<-mat.or.vec(n.features,n.classA+n.classB)
# initializing the classes.ID vector
classes.Id<-c(rep(0,n.classA),rep(1,n.classB))
# simulating the features with the normal distribution
# note that the higher the number of the row, the higher
# is the gap between the means of the simulated normal distribution
for(i in 1:n.features)
{
features[i,]<-c(rnorm(n.classA,1,1),rnorm(n.classB,1+i/200,1))
}
### Selecting the features and comparing the speed changing the fast parameter
### NOTE: there may be differences between the selected features due to some
### randomness present in the algorithm.
system.time({
feat<-featureSelection(features, classes.Id, alpha = 0.05, alphaCorr = 0.05,
minAcc = 0.65, fast = FALSE, testProp = 0.2)
})
system.time({
fastFeat<-featureSelection(features, classes.Id, alpha = 0.05, alphaCorr = 0.05,
minAcc = 0.65, fast = TRUE, testProp = 0.2)
})
### Reducing the initial data frame to the selected features
names(fastFeat)
SelectedFeatures <- features[fastFeat$Selected,]
Run the code above in your browser using DataLab