数据挖掘实验报告

  • 格式:doc
  • 大小:1.34 MB
  • 文档页数:16

《数据挖掘》实验报告

实验序号: 实验项目名称:C4.5算法

学 号 姓 名 专业、班 12数学金融

实验地点 实验楼5-510 指导教师 潘巍巍 实验时间 2014.12.24

一、实验目的及要求

1:选择一个数据挖掘标准数据集,采用C4.5算法进行分类,给出分类精度,画出用C4.5算法诱导的树并写出生成的规则集合。

2:在数据挖掘标准数据集上,实验对比剪枝与未剪枝的树的分类性能。

3:总结C4.5算法的优缺点

二、实验设备(环境)及要求

电脑 WEKA 3.6.1

三、实验内容与步骤

(3)数据分类(c4.5算法实现)

1.导入数据

(2)选择C4.5分类器进行分类

结果为

其中分类精度为50%

生成的决策树为

分类规则:

J48 pruned tree

------------------

outlook = sunny

| humidity = high: no (3.0)

| humidity = normal: yes (2.0)

outlook = overcast: yes (4.0)

outlook = rainy

| windy = TRUE: no (2.0)

| windy = FALSE: yes (3.0)

剪枝后结果为 分类精度变为57.1% 性能变好

(1)C4.5算法优缺点

优点: 分类精度高,生成的分类规则比较简单,易于理解。

缺点: 需要多次扫描数据集,比较低效

五、分析与讨论

六、教师评语

签名:

日期: 成绩

《数据挖掘》实验报告

实验序号: 实验项目名称:KNN算法

学 号 姓 名 专业、班 12数学金融

实验地点 实验楼5-510 指导教师 潘巍巍 实验时间 2014.12.24

一、实验目的及要求

1:KNN算法的基本思路、步骤。

2:选择UCI中的5个标准数据集,使用KNN算法在该数据集上计算混淆矩阵。

3:选择2个数据集,选择不同的k值,k=1,3,5,7,9,对比KNN算法计算结果的差异。

二、实验设备(环境)及要求

电脑 WEKA 3.6.1

四、实验内容与步骤

1.数据集 contact-lenses.arff

Glass.arff

两者的混淆矩阵分别为

(2)两个数据集在K=1,3,5,7,9下结果分别为

Glass:

K=1;

=== Summary ===

Correctly Classified Instances 151 70.5607 %

Incorrectly Classified Instances 63 29.4393 %

Kappa statistic 0.6005

Mean absolute error 0.0897

Root mean squared error 0.2852

Relative absolute error 42.3747 %

Root relative squared error 87.8627 %

Total Number of Instances 214

=== Detailed Accuracy By Class ===

TP Rate FP Rate Precision Recall F-Measure ROC Area Class

0.786 0.167 0.696 0.786 0.738 0.806 build wind float

0.671 0.13 0.739 0.671 0.703 0.765 build wind

non-float

0.294 0.051 0.333 0.294 0.313 0.59 vehic wind float

0 0 0 0 0 ? vehic wind

non-float

0.769 0.03 0.625 0.769 0.69 0.895 containers

0.778 0.015 0.7 0.778 0.737 0.838 tableware

0.793 0.011 0.92 0.793 0.852 0.884 headlamps

Weighted Avg. 0.706 0.109 0.709 0.706 0.704 0.792

=== Confusion Matrix ===

a b c d e f g <-- classified as

55 9 6 0 0 0 0 | a = build wind float

15 51 4 0 3 2 1 | b = build wind non-float

9 3 5 0 0 0 0 | c = vehic wind float

0 0 0 0 0 0 0 | d = vehic wind non-float

0 2 0 0 10 0 1 | e = containers

0 1 0 0 1 7 0 | f = tableware

0 3 0 0 2 1 23 | g = headlamps

K=3;

=== Summary ===

Correctly Classified Instances 154 71.9626 %

Incorrectly Classified Instances 60 28.0374 %

Kappa statistic 0.6097 Mean absolute error 0.0983

Root mean squared error 0.2524

Relative absolute error 46.4438 %

Root relative squared error 77.7792 %

Total Number of Instances 214

=== Detailed Accuracy By Class ===

TP Rate FP Rate Precision Recall F-Measure ROC Area Class

0.843 0.215 0.656 0.843 0.738 0.865 build

wind float

0.711 0.138 0.74 0.711 0.725 0.835 build

wind non-float

0.176 0.015 0.5 0.176 0.261 0.672 vehic wind

float

0 0 0 0 0 ? vehic

wind non-float

0.615 0.015 0.727 0.615 0.667 0.913

containers

0.778 0.01 0.778 0.778 0.778 0.914 tableware

0.793 0.011 0.92 0.793 0.852 0.885

headlamps

Weighted Avg. 0.72 0.123 0.718 0.72 0.708 0.847

=== Confusion Matrix ===

a b c d e f g <-- classified as

59 10 1 0 0 0 0 | a = build wind float

19 54 2 0 1 0 0 | b = build wind non-float

10 4 3 0 0 0 0 | c = vehic wind float

0 0 0 0 0 0 0 | d = vehic wind non-float

0 3 0 0 8 0 2 | e = containers

0 1 0 0 1 7 0 | f = tableware

2 1 0 0 1 2 23 | g = headlamps

K=5; === Summary ===

Correctly Classified Instances 145 67.757 %

Incorrectly Classified Instances 69 32.243 %

Kappa statistic 0.5469

Mean absolute error 0.1085