Hi to all, I'm new to this forum and new to R. I have to build a tree classifier that has boolean values as response. When I build the tree with: echoknn.tree <- tree(class ~ ., data=echoknn.train) where "class" is a coloumn of my dataset (echoknn.train) of boolean values, the result is a tree where leaf nodes are numbers in the range [0,1]; but this isn't the result that I expect to have. I'd want that result of classifier is TRUE or FALSE. Can someone help me? Thanks. Fabio -- View this message in context: http://r.789695.n4.nabble.com/Classifying-boolean-values-tp3579993p3579993.html Sent from the R help mailing list archive at Nabble.com.
It's likely that class is numeric and you actually want factor (regression tree vs classification tree). str(echoknn.train) will show you. By saying, "I have to build a tree classifier" you make me think that this is a course assignment. If it is, you should perhaps talk to your instructor. If not, then a more detailed and reproducible example will usually get you a more informative answer, since it will allow people to actually run and debug your code. Sarah On Tue, Jun 7, 2011 at 11:47 AM, Grifone <fabio.podda at alice.it> wrote:> Hi to all, I'm new to this forum and new to R. I have to build a tree > classifier that has boolean values as response. > When I build the tree with: > > echoknn.tree <- tree(class ~ ., data=echoknn.train) > > where "class" is a coloumn of my dataset (echoknn.train) of boolean values, > the result is a tree where leaf nodes are numbers in the range [0,1]; but > this isn't the result that I expect to have. I'd want that result of > classifier is TRUE or FALSE. > Can someone help me? > > Thanks. > > Fabio > >-- Sarah Goslee http://www.functionaldiversity.org
Thanks Sarah for the response; with the command str(echoknn.train) the coloumn "class" is a "logi" value (i think without any immagination that is a logical value ). So, how can I handle this type of data? Thanks a lot. P.S. Yes, is a course assignment and i was hoping to solve this problem (that i consider just a beginner problem) without asking my teacher . -- View this message in context: http://r.789695.n4.nabble.com/Classifying-boolean-values-tp3579993p3581980.html Sent from the R help mailing list archive at Nabble.com.
Convert it to a factor? Uwe Ligges On 08.06.2011 10:44, Grifone wrote:> Thanks Sarah for the response; with the command > > str(echoknn.train) > > the coloumn "class" is a "logi" value (i think without any immagination that > is a logical value ). So, how can I handle this type of data? > > Thanks a lot. > > P.S. Yes, is a course assignment and i was hoping to solve this problem > (that i consider just a beginner problem) without asking my teacher . > > -- > View this message in context: http://r.789695.n4.nabble.com/Classifying-boolean-values-tp3579993p3581980.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.