Skip to content

Commit 500767e

Browse files
author
linyiqun
committed
Apriori算法频繁项集类
Apriori算法频繁项集类
1 parent 699ffa3 commit 500767e

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package DataMining_MSApriori;
2+
3+
/**
4+
* 频繁项集
5+
*
6+
* @author lyq
7+
*
8+
*/
9+
public class FrequentItem implements Comparable<FrequentItem>{
10+
// 频繁项集的集合ID
11+
private String[] idArray;
12+
// 频繁项集的支持度计数
13+
private int count;
14+
//频繁项集的长度,1项集或是2项集,亦或是3项集
15+
private int length;
16+
17+
public FrequentItem(String[] idArray, int count){
18+
this.idArray = idArray;
19+
this.count = count;
20+
length = idArray.length;
21+
}
22+
23+
public String[] getIdArray() {
24+
return idArray;
25+
}
26+
27+
public void setIdArray(String[] idArray) {
28+
this.idArray = idArray;
29+
}
30+
31+
public int getCount() {
32+
return count;
33+
}
34+
35+
public void setCount(int count) {
36+
this.count = count;
37+
}
38+
39+
public int getLength() {
40+
return length;
41+
}
42+
43+
public void setLength(int length) {
44+
this.length = length;
45+
}
46+
47+
@Override
48+
public int compareTo(FrequentItem o) {
49+
// TODO Auto-generated method stub
50+
Integer int1 = Integer.parseInt(this.getIdArray()[0]);
51+
Integer int2 = Integer.parseInt(o.getIdArray()[0]);
52+
53+
return int1.compareTo(int2);
54+
}
55+
56+
}

0 commit comments

Comments
 (0)