File tree Expand file tree Collapse file tree 5 files changed +725
-0
lines changed
SequentialPatterns/DataMining_PrefixSpan Expand file tree Collapse file tree 5 files changed +725
-0
lines changed Original file line number Diff line number Diff line change
1
+ package DataMining_PrefixSpan ;
2
+
3
+ /**
4
+ * PrefixSpan序列模式挖掘算法
5
+ * @author lyq
6
+ *
7
+ */
8
+ public class Client {
9
+ public static void main (String [] agrs ){
10
+ String filePath = "C:\\ Users\\ lyq\\ Desktop\\ icon\\ input.txt" ;
11
+ //最小支持度阈值率
12
+ double minSupportRate = 0.4 ;
13
+
14
+ PrefixSpanTool tool = new PrefixSpanTool (filePath , minSupportRate );
15
+ tool .prefixSpanCalculate ();
16
+ }
17
+ }
18
+
Original file line number Diff line number Diff line change
1
+ package DataMining_PrefixSpan ;
2
+
3
+ import java .util .ArrayList ;
4
+
5
+ /**
6
+ * 字符项集类
7
+ *
8
+ * @author lyq
9
+ *
10
+ */
11
+ public class ItemSet {
12
+ // 项集内的字符
13
+ private ArrayList <String > items ;
14
+
15
+ public ItemSet (String [] str ) {
16
+ items = new ArrayList <>();
17
+ for (String s : str ) {
18
+ items .add (s );
19
+ }
20
+ }
21
+
22
+ public ItemSet (ArrayList <String > itemsList ) {
23
+ this .items = itemsList ;
24
+ }
25
+
26
+ public ItemSet (String s ) {
27
+ items = new ArrayList <>();
28
+ for (int i = 0 ; i < s .length (); i ++) {
29
+ items .add (s .charAt (i ) + "" );
30
+ }
31
+ }
32
+
33
+ public ArrayList <String > getItems () {
34
+ return items ;
35
+ }
36
+
37
+ public void setItems (ArrayList <String > items ) {
38
+ this .items = items ;
39
+ }
40
+
41
+ /**
42
+ * 获取项集最后1个元素
43
+ *
44
+ * @return
45
+ */
46
+ public String getLastValue () {
47
+ int size = this .items .size ();
48
+
49
+ return this .items .get (size - 1 );
50
+ }
51
+ }
You can’t perform that action at this time.
0 commit comments