题 目 iris数据集的KDD实验
学院名称 信息科学与技术学院
专业名称 计算机科学与技术
学生姓名 何东升 学生学号 201413030119 指导教师 实习地点 成都理工大学 实习成绩
二〇 一六年 9月
iris数据集的KDD实验
第1章、实验目的及内容
1.1 实习目的
知识发现(KDD:Knowledge Discovery in Database)是从数据集中识别出有效的、
新颖的、潜在有用的,以及最终可理解的模式的非平凡过程。知识发现将信息变为知识,从数据矿山中找到蕴藏的知识金块,将为知识创新和知识经济的发展作出贡献。该术语于1989年出现,Fayyad定义为\"KDD\"是从数据集中识别出有效的、新颖的、潜在有用的,以及最终可理解的模式的非平凡过程”。
KDD的目的是利用所发现的模式解决实际问题,“可被人理解”的模式帮助人们理解模
式中包含的信息,从而更好的评估和利用。
1.2 算法的核心思想
作为一个KDD的工程而言,KDD通常包含一系列复杂的挖掘步骤.
Fayyad,Piatetsky-Shapiro 和 Smyth 在 1996年合作发布的论文 1: selection: 在第一个步骤中我们往往要先知道什么样的数据可以应用于我们的KDD工程中. 2: pre-processing: 当采集到数据后,下一步必须要做的事情是对数据进行预处理,尽量消除数据中存在 的错误以及缺失信息. 3: transformation: 转换数据为数据挖掘工具所需的格式.这一步可以使得结果更加理想化. 4: data mining: 应用数据挖掘工具. 5:interpretation/ evaluation: 了解以及评估数据挖掘结果. 1.3 实验软件:Weka3-9. 数据集来源:http://archive.ics.uci.edu/ml/datasets/Iris 第2章、实验过程 2.1数据准备 1.从uci的数据集官网下载iris的数据源 2.抽取数据,清洗数据,变换数据 3.iris的数据集如图 Iris也称鸢尾花卉数据集,是一类多重变量分析的数据集。通过花萼长度,花萼宽度,花瓣长度,花瓣宽度4个属性预测鸢尾花卉属于(Setosa,Versicolour,Virginica)三个种类中的哪一类。 2.2 实验过程 2.2.1.建模 (1)C4.5数据挖掘算法 使用weka进行有指导的学习训练,选择C4.5数据挖掘算法,在Weka中名为J48,将test options 设置为 Percentage split ,使用默认百分比66%。 选择class作为输出属性。如图所示: 2.设置完成后点击start开始执行 (2)Simple KMeans算法 1加载数据到Weka,切换到Cluster选项卡,选择Simple KMeans算法、 2.设置算法参数,显示标准差,迭代次数设为5000次,其他默认。簇数选 择3,因为花的种类为3。如下图所示 3.在Cluster Mode 面板选择评估数据为Use trainin set,并单击Ignore attribu,忽略class属性。 4.点击start按钮,执行程序 第三章 实验结果及分析 3.1 C4.5结果分析 1.运行结果 === Run information === Scheme: weka.classifiers.trees.J48 -C 0.25 -M 2 Relation: iris Instances: 150 Attributes: 5 sepal length sepal width petal length petal width class Test mode: split 66.0% train, remainder test === Classifier model (full training set) === J48 pruned tree ------------------ petal width <= 0.6: Iris-setosa (50.0) petal width > 0.6 | petal width <= 1.7 | | petal length <= 4.9: Iris-versicolor (48.0/1.0) | | petal length > 4.9 | | | petal width <= 1.5: Iris-virginica (3.0) | | | petal width > 1.5: Iris-versicolor (3.0/1.0) | petal width > 1.7: Iris-virginica (46.0/1.0) Number of Leaves : 5 Size of the tree : 9 Time taken to build model: 0.01 seconds === Evaluation on test split === Time taken to test model on training split: 0 seconds === Summary === Correctly Classified Instances 49 96.0784 % Incorrectly Classified Instances 2 3.9216 % Kappa statistic 0.9408 Mean absolute error 0.0396 Root mean squared error 0.1579 Relative absolute error 8.8979 % Root relative squared error 33.4091 % Total Number of Instances 51 === Detailed Accuracy By Class === TP Rate FP Rate Precision Recall F-Measure MCC ROC Area PRC Area Class 1.000 0.000 1.000 1.000 1.000 1.000 1.000 1.000 Iris-setosa 1.000 0.063 0.905 1.000 0.950 0.921 0.969 0.905 Iris-versicolor 0.882 0.000 1.000 0.882 0.938 0.913 0.967 0.938 Iris-virginica Weighted Avg. 0.961 0.023 0.965 0.961 0.961 0.942 0.977 0.944 === Confusion Matrix === a b c <-- classified as 15 0 0 | a = Iris-setosa 0 19 0 | b = Iris-versicolor 0 2 15 | c = Iris-virginica 从上述结果可以看出正确率为96.0784 %所以petal width和petal length 可以很好的判断花的类别。 3.1 Simple KMeans 算法结果 === Run information === Scheme: weka.clusterers.SimpleKMeans -init 0 -max-candidates 100 -periodic-pruning 10000 -min-density 2.0 -t1 -1.25 -t2 -1.0 -V -N 3 -A \"weka.core.EuclideanDistance -R first-last\" -I 500 -num-slots 1 -S 10 Relation: iris Instances: 150 Attributes: 5 sepal length sepal width petal length petal width Ignored: class Test mode: evaluate on training data === Clustering model (full training set) === kMeans ====== Number of iterations: 6 Within cluster sum of squared errors: 6.998114004826762 Initial starting points (random): Cluster 0: 6.1,2.9,4.7,1.4 Cluster 1: 6.2,2.9,4.3,1.3 Cluster 2: 6.9,3.1,5.1,2.3 Missing values globally replaced with mean/mode Final cluster centroids: Cluster# Attribute Full Data 0 1 2 (150.0) (61.0) (50.0) (39.0) =========================================================== sepal length 5.8433 5.8885 5.006 6.8462 +/-0.8281 +/-0.4487 +/-0.3525 +/-0.5025 sepal width 3.054 2.7377 3.418 3.0821 +/-0.4336 +/-0.2934 +/-0.381 +/-0.2799 petal length 3.7587 4.3967 1.464 5.7026 +/-1.7644 +/-0.5269 +/-0.1735 +/-0.5194 petal width 1.1987 1.418 0.244 2.0795 +/-0.7632 +/-0.2723 +/-0.1072 +/-0.2811 Time taken to build model (full training data) : 0 seconds === Model and evaluation on training set === Clustered Instances 0 61 ( 41%) 1 50 ( 33%) 2 39 ( 26%) 从实验结果可以看出分出的类为3个且比例与元数据的class的比例1:1:1的比例不是很相近。从C4.5的结果来看pental width和pental length 更加符合,重新选择属性,仅选择pental width和pental length 结果如下 === Run information === Scheme: weka.clusterers.SimpleKMeans -init 0 -max-candidates 100 -periodic-pruning 10000 -min-density 2.0 -t1 -1.25 -t2 -1.0 -V -N 3 -A \"weka.core.EuclideanDistance -R first-last\" -I 5009 -num-slots 1 -S 10 Relation: iris Instances: 150 Attributes: 5 petal length petal width Ignored: sepal length sepal width class Test mode: evaluate on training data === Clustering model (full training set) === kMeans ====== Number of iterations: 6 Within cluster sum of squared errors: 1.7050986081225123 Initial starting points (random): Cluster 0: 4.7,1.4 Cluster 1: 4.3,1.3 Cluster 2: 5.1,2.3 Missing values globally replaced with mean/mode Final cluster centroids: Cluster# Attribute Full Data 0 1 2 (150.0) (52.0) (50.0) (48.0) =========================================================== petal length 3.7587 4.2962 1.464 5.5667 +/-1.7644 +/-0.5053 +/-0.1735 +/-0.549 petal width 1.1987 1.325 0.244 2.0562 +/-0.7632 +/-0.1856 +/-0.1072 +/-0.2422 Time taken to build model (full training data) : 0.02 seconds === Model and evaluation on training set === Clustered Instances 0 52 ( 35%) 1 50 ( 33%) 2 48 ( 32%) 从结果可以看出pental width和pental length 能够很好的作为分类的属性值 第四章 心得体会 从这次的作业中学习了KDD以及KDD模型过程的建立。也更加深入的了解了C4.5决策树算法和KMeans分类算法以及Weka软件的使用。掌握了一些数据挖掘方面的算法思想。虽然过程中遇到了不少问题,但通过各种途径能得以解决。虽然整个作业还没有做到非常完美和正确,我想信不断的联系摸索,一定能收获更多! 因篇幅问题不能全部显示,请点此查看更多更全内容