is there anybody can tell me how to define the formula in the rweka?
A<- InfoGainAttributeEval(formula ~ . , data = TrainDataLSVT,na.action=NULL )
there are 310 features in the TrainDataLSVT.
is there anybody can tell me how to define the formula in the rweka?
A<- InfoGainAttributeEval(formula ~ . , data = TrainDataLSVT,na.action=NULL )
there are 310 features in the TrainDataLSVT.
Since you do not provide your data, I will illustrate with the built-in iris data (see ?iris
). For this data, the goal is to predict the Species as a function of the other variables. You can express that as a formula for InfoGainAttributeEval
like this:
InfoGainAttributeEval(Species ~ ., data=iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width
0.6982615 0.3855963 1.4180030 1.3784027
The values returned are the scores for each variable. The key part is the formula Species ~ .
You should read this as "Species as a function of all other variables". Details on how to write a formula are available on the help page ?formula
.