Skip to content

Commit 699ffa3

Browse files
author
linyiqun
committed
ms-apriori算法测试类
ms-apriori算法测试类
1 parent d707095 commit 699ffa3

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package DataMining_MSApriori;
2+
3+
/**
4+
* 基于多支持度的Apriori算法测试类
5+
* @author lyq
6+
*
7+
*/
8+
public class Client {
9+
public static void main(String[] args){
10+
//是否是事务型数据
11+
boolean isTransaction;
12+
//测试数据文件地址
13+
String filePath = "C:\\Users\\lyq\\Desktop\\icon\\input.txt";
14+
//关系表型数据文件地址
15+
String tableFilePath = "C:\\Users\\lyq\\Desktop\\icon\\input2.txt";
16+
//最小支持度阈值
17+
double minSup;
18+
// 最小置信度率
19+
double minConf;
20+
//最大支持度差别阈值
21+
double delta;
22+
//多项目的最小支持度数,括号中的下标代表的是商品的ID
23+
double[] mis;
24+
//msApriori算法工具类
25+
MSAprioriTool tool;
26+
27+
//为了测试的方便,取一个偏低的置信度值0.3
28+
minConf = 0.3;
29+
minSup = 0.1;
30+
delta = 0.5;
31+
//每项的支持度率都默认为0.1,第一项不使用
32+
mis = new double[]{-1, 0.1, 0.1, 0.1, 0.1, 0.1};
33+
isTransaction = true;
34+
35+
isTransaction = true;
36+
tool = new MSAprioriTool(filePath, minConf, delta, mis, isTransaction);
37+
tool.calFItems();
38+
System.out.println();
39+
40+
isTransaction = false;
41+
//重新初始化数据
42+
tool = new MSAprioriTool(tableFilePath, minConf, minSup, isTransaction);
43+
tool.calFItems();
44+
}
45+
}

0 commit comments

Comments
 (0)