[R] FSelector and RWeka problem
Yanwei Song
yanwei.song at gmail.com
Thu Sep 8 04:12:40 CEST 2011
Hi,
Here is a follow up, I resolve the problem in another way.
"
> e <- evaluate_Weka_classifier(p)
> print(subset)
> print(e$details[1])
> return(e$details[1])"
change this lines to
"
e <- sum(iris$Species == predict(p))/nrow(iris)
print(subset)
print(e)
return(e)
================
It works well, but I still don't understand why the previous one didn't work. Maybe there is a compatibility problem...
Yanwei
On Sep 7, 2011, at 8:47 PM, Yanwei Song wrote:
> Hi all,
>
> Last post didn't give the plain format:
>
> I was trying to combine RWeka and FSelector, and do the forward feature selection with J48/C5.4 decision tree:
>
> Here is the code:
> #==================
> library(RWeka)
> library(FSelector)
> library(rpart)
>
>
> data(iris)
> evaluator <- function(subset) {
> p <- J48(as.simple.formula(subset, "Species"), data=iris)
> e <- evaluate_Weka_classifier(p)
> print(subset)
> print(e$details[1])
> return(e$details[1])
> }
>
>
> subset <- forward.search(names(iris)[-5], evaluator)
> =========================
> I got this error, when I ran it:
>
> Error in paste(attributes, sep = "", collapse = " + ") :
> cannot coerce type 'closure' to vector of type 'character'
>
> I don't know how I could fix this problem.
> Thanks.
>
>
> Yanwei
>
>
>
>
More information about the R-help
mailing list