DW&DM课程实验报告 班级:信管 1 1 -1 姓名:*** 学号:************ 一、 实验目的 验证 二、 实验内容 (一) 聚类分析 (1)数据准备 1. 数据文件格式转换 使用WEKA 作数据挖掘,面临的第一个问题往往是我们的数据不是ARFF 格式的。幸好,WEKA 还提供了对CSV 文件的支持,而这种格式是被很多其他软件,比如Excel,所支持的。现在我们打开“bank-data.csv”。 利用WEKA 可以将CSV 文件格式转化成ARFF 文件格式。ARFF格式是WEKA 支持得最好的文件格式。 此外,WEKA 还提供了通过JDBC 访问数据库的功能。 2.“Explorer”界面 “Explorer”提供了很多功能,是WEKA 使用最多的模块。 3. bank-data 数据各属性的含义如下: id: a unique identification number age: age of customer in years (numeric) sex: MALE / FEMALE region: inner_city/rural/suburban/town income: income of customer (numeric) married: is the customer married (YES/NO) children: number of children (numeric) car: does the customer own a car (YES/NO) save_act: does the customer have a saving account (YES/NO) current_act:does the customer have a current account (YES/NO) mortgage: does the customer have a mortgage (YES/NO) pep: did the customer buy a PEP (Personal Equity Plan,个人参股计划) after the last mailing (YES/NO) 上图显示的是 “Explorer”打开“bank-data.csv”的情况。 (2)聚类的任务是把所有的实例分配到若干的簇,使得同一个簇的实例聚集在一个簇中心的周围,它们之间距离的比较近;而不同簇实例之间的距离比较远。现在我们对前面的“Fund-data-normal”作聚类分析,使用最常见的K 均值(K-means)算法。 运行WEKA 的主程序,我们点击进入“Simple CLI”模块提供的命令行功能。在 D 盘下进行转换,在新窗口的最下方输入框写上javaweka.core.converters.CSVLoader D:/Fund-data.csv > D:/Fund-data.csv.arff 即可完成转换,生成文件“D:/Fund-data.csv.arff”。用“Explorer”打开训练集“Fund-data-normal.arff”。用“Explorer”打开刚才得到的“Fund-data-normal.arff”,并切换到“Cluster”。点“Choose”按钮选择“SimpleKMeans”,这是 WEKA 中实现 K 均值的算法。点击旁边...