Fast Correlation Filter Selection

走远了吗. 提交于 2019-12-11 05:36:58

问题


I want to implement FCFS on my training set to select the most relevant and unredundant dependent variables using the r package (Biocomb) then test the selected feature on svm to ensure their efficiency on the classifier performance(svm) but i didn't understand the parameter attrs.nominal Do i have to add all nominal variables in my dataset in order to discretize them ? Any explanation will be appreciated. Error in [.data.frame(data.validation, , 72) : undefined columns selected Error during wrapup: cannot open the connection

#fast correlation based feature selection in r
library(Biocomb)
library(caret)
library(e1071)
#split data into train and test
trainIndex <- createDataPartition(data$Species, p=0.7, list=FALSE)
data_train <- data[ trainIndex,]
data_test <- data[-trainIndex,]
set.seed(10)
#dicretisation of numericl variable
disc<-"MDL"
#a numeric threshold v for the correlation of feature with class (final subset)
threshold=0.2
#a numerical vector, containing the column numbers of the nominal features
attrs.nominal=72
out=select.fast.filter(data_train, disc.method=disc, threshold=threshold,attrs.nominal=attrs.nominal)
out=unlist(out)
#Using selected features to train svm
svm_model<-svm(Species~out,data_train[,out],cost=.1,kernel="radial")
    #Predict test set
p<-predict(svm_model,data_test[,-5])
accuracy=mean(p==data_test[,5])

来源:https://stackoverflow.com/questions/49499527/fast-correlation-filter-selection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!