J48使用Weka分类

时间:2015-01-08 02:02:14

标签: weka

我有一些数据要分类,但是我不能在这里发帖所以我做了一个类似的(但很愚蠢)数据的例子,(类似的属性和数据),我的内容:

@Relation Food

@Attribute  Type { Healthy ,  Not_Healthy}
@Attribute Veggie   {TRUE, FALSE}
@Attribute From { McDonalds ,  BurgerKing ,  Hardees ,  Somewhere  ,  SomewhereElse }
@Attribute Size    {Small ,  Large}
@Attribute WithBun {'y', 'n'}
@Attribute meat {'y', 'n'}
@Attribute Sauce {'y', 'n'}
@Attribute Syrup {'y', 'n'}
@Attribute Cheese {'y', 'n'}
@Attribute Mayo {'y', 'n'}
@Attribute Ketchup {'y', 'n'}
@Attribute Sweetner {'y', 'n'}
@Attribute Milk {'y', 'n'}
@Attribute Food_is    { Burger,  Ribs ,  Nuggets,  Donuts , Hotdog,  Pizza ,  Rice_Pudding , Steak , Fries, Fatty_food }


@data
 Healthy ,TRUE,  BurgerKing , Large, 'y', 'y', 'y', 'y', 'n', 'n', 'n', 'n', 'n' , Burger 
 Not_Healthy ,TRUE, McDonalds , Small , 'y', 'y', 'y', 'y', 'y', 'y', 'n', 'y', 'n' ,  Ribs 
 Healthy ,TRUE, McDonalds , Large, 'y','y', 'n', 'y', 'y', 'n', 'y', 'y', 'n' , Donuts
 Not_Healthy ,FALSE, Hardees , Large , 'y','y', 'y', 'y', 'y', 'y', 'y', 'n', 'n', Hotdog
 Not_Healthy ,TRUE, Somewhere , Small ,'y','y', 'y','y', 'y', 'y', 'y', 'n','n',Pizza
 Healthy ,TRUE, SomewhereElse , Large , 'y', 'y', 'y', 'y', 'n', 'y', 'n', 'n', 'n',Pizza
 Not_Healthy ,TRUE, McDonalds , Small , 'n','n','y','y','n','y','n','n','n', Donuts
 Not_Healthy ,FALSE, Hardees , Large , 'n', 'y', 'y', 'n', 'n', 'y', 'n', 'n', 'n',Fries
 Not_Healthy ,FALSE, Hardees , Large ,'n','y', 'y', 'y', 'n', 'y', 'n', 'n', 'y', Rice_Pudding
 Not_Healthy ,FALSE, Hardees , Large, 'n', 'y', 'y', 'y', 'y', 'n', 'n', 'n', 'n', Steak 

分类结果是:10个中有5个分类正确,树看起来像这样: J48 Tree

  • 分配给最后一个属性的类,为什么树不能真正反映数据?我在这做错了什么?

通过反思,我不是说(蔬菜应该是这个或那个)我的意思是树应该更深,应该包含更多的水平。

由于

0 个答案:

没有答案