strinz at freenet.de
2007-Jul-11 12:16 UTC
[R] RWeka control parameters classifiers interface
Hello, I have some trouble in achieving the desired parametrisation for the weka classifier functions, using the package RWeka. The problem is, that the functions result=classifier(formula, data, subset, na.action, control = Weka_control(mycontrol)) do not seem to be manipulated by the mycontrol- arguments Perhaps this should be resepected via the handlers- argument , but the documentation in this regard is rather sparse. # ------------- Examples file =system.file("arff","iris.arff",package="RWeka") data =read.arff(file=file) rownames(data)=1:nrow(data) colnames(data)[ncol(data)] ="class" library(RWeka) # Example: no parameter influence mySMO =make_Weka_classifier(name="weka/classifiers/functions/SMO",class=NULL,handlers=list()); # Using control =Weka_control() m1 =mySMO(formula=class~.,data=data[,],control=Weka_control(K="weka.classifiers.functions.supportVector.PolyKernel",E=2)) m2 =mySMO(formula=class~.,data=data[,],control=Weka_control(K="weka.classifiers.functions.supportVector.PolyKernel",E=3)) m3 =mySMO(formula=class~.,data=data[,],control=c("K","weka.classifiers.functions.supportVector.PolyKernel","E",3)) # Using predefinded interface, does not work x1 =SMO(formula=class~.,data=data[,],control=Weka_control(K="weka.classifiers.functions.supportVector.PolyKernel",E=2)) x2 =SMO(formula=class~.,data=data[,],control=Weka_control(K="weka.classifiers.functions.supportVector.PolyKernel",E=3)) m1$call m2$call m3$call x1$call x2$call # no differences: m1 m2 m3 x1 x2 Any suggestions? Many thanks Bjoern many thanks bjoern
On Wed, 11 Jul 2007 strinz at freenet.de wrote:> The problem is, that the functions > result=classifier(formula, data, subset, na.action, control = Weka_control(mycontrol)) > do not seem to be manipulated by the mycontrol- argumentsYes, they are...not all parameter changes have always an effect on the specified learner.> Perhaps this should be resepected via the handlers- argument , > but the documentation in this regard is rather sparse.Handlers are not needed here. Re: sparse docs. In case you have not seen that paper already, there is a technical report on the ideas behind RWeka: http://epub.wu-wien.ac.at/dyn/openURL?id=oai:epub.wu-wien.ac.at:epub-wu-01_ba6 Re: SMO. Compare m1 <- SMO(Species ~ ., data = iris) m2 <- SMO(Species ~ ., data = iris, control = Weka_control( K = "weka.classifiers.functions.supportVector.RBFKernel")) which yield different results so the Weka_control() works. The same happens if you register the mySMO() interface yourself. I'm not sure why the "E = ..." argument has no influence on the SMO, please check the Weka docs for this particular learner. Best, Z
strinz at freenet.de
2007-Jul-12 11:18 UTC
[R] RWeka control parameters classifiers interface
Hi, many thanks for the answer. It ist true, that for example m1 <- SMO(Species ~ ., data = iris, control = Weka_control( K = "weka.classifiers.functions.supportVector.PolyKernel")) m2 <- SMO(Species ~ ., data = iris, control = Weka_control( K = "weka.classifiers.functions.supportVector.RBFKernel")) deliver different results but m3 <- SMO(Species ~ ., data = iris, control = Weka_control( K = "weka.classifiers.functions.supportVector.PolyKernel",E=2)) m4 <- SMO(Species ~ ., data = iris, control = Weka_control( K = "weka.classifiers.functions.supportVector.RBFKernel"),G=0.2) m3 does not differ from m1 (from the point of view of the setup, irrespective of the data!) m4 does not differ from m2 (from the point of view of the setup, irrespective of the data!) which can be seen, when looking at the results: m1 # (Linear Kernel, okay ) m2 # (RBF Kernel, okay) m3 # still uses a linear kernel, but should be a <x,y>^2 kernel m4 # G is ignored, resulting in m2 Thx Bjoern ----- original Nachricht -------- Betreff: Re: [R] RWeka control parameters classifiers interface Gesendet: Mi 11 Jul 2007 14:42:10 CEST Von: "Achim Zeileis"<Achim.Zeileis at wu-wien.ac.at>> On Wed, 11 Jul 2007 strinz at freenet.de wrote: > > > The problem is, that the functions > > result=classifier(formula, data, subset, na.action, control > Weka_control(mycontrol)) > > do not seem to be manipulated by the mycontrol- arguments > > Yes, they are...not all parameter changes have always an effect on the > specified learner. > > > Perhaps this should be resepected via the handlers- argument , > > but the documentation in this regard is rather sparse. > > Handlers are not needed here. > > Re: sparse docs. In case you have not seen that paper already, there is a > technical report on the ideas behind RWeka: > > http://epub.wu-wien.ac.at/dyn/openURL?id=oai:epub.wu-wien.ac.at:epub-wu-01_b > a6 > > Re: SMO. Compare > > m1 <- SMO(Species ~ ., data = iris) > m2 <- SMO(Species ~ ., data = iris, control = Weka_control( > K = "weka.classifiers.functions.supportVector.RBFKernel")) > > which yield different results so the Weka_control() works. > > The same happens if you register the mySMO() interface yourself. I'm not > sure why the "E = ..." argument has no influence on the SMO, please check > the Weka docs for this particular learner. > > Best, > Z > > >--- original Nachricht Ende ----