如何使用此规则集按优先级对测试对象进行分类?

数据挖掘 分类 关联规则
2022-02-20 09:11:20

我正在编写一个程序,该程序通过数据库weather.arff 测试多个分类器,我在下面找到了规则,我想对测试对象进行分类。

不明白怎么分类,是这样描述的:“在分类中,设R为生成的规则集合,T为训练数据。所提出的方法的基本思想是在R中选择一组高置信度的规则来覆盖T. 在对测试对象进行分类时,规则集中与测试对象条件匹配的第一个规则对其进行分类。此过程确保只有排名最高的规则才能对测试对象进行分类。”

如何对测试对象进行分类?

No. outlook temperature humidity    windy   play
1   sunny       hot     high        FALSE   no
2   sunny       hot     high        TRUE    no
3   overcast    hot     high        FALSE   yes
4   rainy       mild    high        FALSE   yes
5   rainy       cool    normal      FALSE   yes
6   rainy       cool    normal      TRUE    no
7   overcast    cool    normal      TRUE    yes
8   sunny       mild    high        FALSE   no
9   sunny       cool    normal      FALSE   yes
10  rainy       mild    normal      FALSE   yes
11  sunny       mild    normal      TRUE    yes
12  overcast    mild    high        TRUE    yes
13  overcast    hot     normal      FALSE   yes
14  rainy       mild    high        TRUE    no

发现规则:

1: (outlook,overcast) -> (play,yes) 
[Support=0.29 , Confidence=1.00 , Correctly Classify= 3, 7, 12, 13]

2: (humidity,normal), (windy,FALSE) -> (play,yes)
[Support=0.29 , Confidence=1.00 , Correctly Classify= 5, 9, 10]

3: (outlook,sunny), (humidity,high) -> (play,no) 
[Support=0.21 , Confidence=1.00 , Correctly Classify= 1, 2, 8]

4: (outlook,rainy), (windy,FALSE) -> (play,yes) 
[Support=0.21 , Confidence=1.00 , Correctly Classify= 4]

5: (outlook,sunny), (humidity,normal) -> (play,yes) 
[Support=0.14 , Confidence=1.00 , Correctly Classify= 11]

6: (outlook,rainy), (windy,TRUE) -> (play,no) 
[Support=0.14 , Confidence=1.00 , Correctly Classify= 6, 14]

谢谢,大粪

1个回答

假设您的测试对象是(sunny, hot, normal, TRUE). 从上到下查看规则,看看是否有任何条件匹配。例如,第一条规则测试该outlook功能。值不匹配,因此规则不匹配。继续下一条规则。等等。在这种情况下,规则 5 匹配测试用例,并且游戏变量的分类为“是”。

更一般地说,对于任何测试用例,查看其特征所采用的值并找到这些值满足的第一条规则。该规则的含义将是它的分类。