- 1
- 0
- 约1.2万字
- 约 12页
- 2019-11-09 发布于安徽
- 举报
标准文案
大全
第三次实验报告
班级:数理系091001
学号:091001102
姓名:高攀
指导老师:刘建伟
Aprior 算法
实验目的:
首先从理论角度分析了关联规则挖掘算法与聚类挖掘算法原理及其应用领域,然后介绍了Aprior算法的实现及封装,并设计了可视化界面,对算法进行了测试。
实验要求:
利用Aprior 算法实现Algorithm数学计算方法。
3.实验原理:
Apriori算法使用一种称作逐层迭代的候选产生测试(candidate generation and test)的方法,k-项目集用于探索(k+1)-项目集。首先,找出频繁1-项目集的集合,该集合记作L 。L 用于找频繁2-向募集到集合L ,而L 用于找L ,如此下去,直到不能找到频繁k-项目集。找每一个L 均需要一次数据库的扫描。
4.实验内容:
package datamining;
import java.io.*;
import java.util.*;
/**
* A bare bone clean implementation of the Apriori
* algorithm for finding frequent itemsets. Good for educational
* purposes and as a root class for experimenting on
* optimizations.
*
* In the latest version the use of DataHandler is added for reading
* the database.
*
* @author Michael Holler
* @version 0.8, 16.03.2004
*/
public class Apriori {
int pass; // number of passes
int total; // total number of frequent itemsets
int minsup; // minimal support of itemset
String filename; // the filename of the database
Item root; // the root item of the Trie
BufferedWriter writer;// the buffer to write the output to
DataHandler dh; // the handler for the database
/**
* Default constructur for creating a Apriori object.
*/
public Apriori() {
this.pass = 0;
this.minsup = 4;
this.dh = new DataHandler(test.dat);
this.root = new Item(0);
}
/**
* Constructur for creating a Apriori object with parameters.
*
* @param filename the name of the database file
* @param minsup the minimal support threshold
* @param outfile the name of the output file
*/
public Apriori(String filename, int minsup, String outfile) {
this.pass = 0;
this.minsup = minsup;
this.dh = new DataHandler(filename);
this.root = new Item(0);
try {
if (!outfile.equals()) {
writer = new BufferedWriter(new FileWriter(outfile));
}
} catch (Exception e) {}
}
/**
* Construct
原创力文档

文档评论(0)