forked from linyiqun/DataMiningAlgorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCluster.java
More file actions
60 lines (49 loc) · 1.17 KB
/
Copy pathCluster.java
File metadata and controls
60 lines (49 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package DataMining_BIRCH;
import java.util.ArrayList;
/**
* 叶子节点中的小集群
* @author lyq
*
*/
public class Cluster extends ClusteringFeature{
//集群中的数据点
private ArrayList<double[]> data;
//父亲节点
private LeafNode parentNode;
public Cluster(String[] record){
double[] d = new double[record.length];
data = new ArrayList<>();
for(int i=0; i<record.length; i++){
d[i] = Double.parseDouble(record[i]);
}
data.add(d);
//计算CF聚类特征
this.setLS(data);
this.setSS(data);
this.setN(data);
}
public ArrayList<double[]> getData() {
return data;
}
public void setData(ArrayList<double[]> data) {
this.data = data;
}
@Override
protected void directAddCluster(ClusteringFeature node) {
//如果是聚类包括数据记录,则还需合并数据记录
Cluster c = (Cluster)node;
ArrayList<double[]> dataRecords = c.getData();
this.data.addAll(dataRecords);
super.directAddCluster(node);
}
public LeafNode getParentNode() {
return parentNode;
}
public void setParentNode(LeafNode parentNode) {
this.parentNode = parentNode;
}
@Override
public void addingCluster(ClusteringFeature clusteringFeature) {
// TODO Auto-generated method stub
}
}