Skip to content

Commit 8826d7c

Browse files
author
linyiqun
committed
构造前缀后缀序列的序列模仿挖掘算法
构造前缀后缀序列的序列模仿挖掘算法
1 parent 9821455 commit 8826d7c

File tree

5 files changed

+725
-0
lines changed

5 files changed

+725
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
}

0 commit comments

Comments
 (0)