-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDemo.java
39 lines (36 loc) · 1.42 KB
/
Demo.java
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
import java.util.function.BiFunction;
import SimilarlyMatrixClustering.Data;
import SimilarlyMatrixClustering.SimilarlyFunction;
import SimilarlyMatrixClustering.SimilarlyMatrixClustering;
public class Demo {
public static void main(String[] args) {
Data[] dataset = Dataset1();
double threshold = 0.6;
int seedIdx = 0;
SimilarlyMatrixClustering cluster = new SimilarlyMatrixClustering(
dataset, threshold, seedIdx,
new BiFunction<Data, Data, Double>() {
@Override
public Double apply(Data t, Data u) {
return SimilarlyFunction.func1(t, u);
}//apply
});
System.out.println(cluster.toString());
System.out.println(cluster.analyzeClusteredInstances());
System.out.println(cluster.analyzeDatasetDistribution());
System.out.println(cluster.analyzeClustersDistribution());
}//main
private static Data[] Dataset1() {
Data[] dataset = {new Data(1, 1, 0, 0, 0, 0, 0, 0, 0),
new Data(2, 1, 1, 1, 0, 0, 0, 1, 0),
new Data(3, 1, 0, 0, 0, 0, 0, 0 ,0),
new Data(4, 1, 1, 1, 1, 0, 0, 1, 1),
new Data(5, 1, 0, 1, 1, 1, 0, 1, 1),
new Data(6, 1, 1, 1, 0, 1, 0, 0, 0),
new Data(7, 1, 0, 1, 0, 0, 0, 1, 1),
new Data(8, 1, 0, 1, 0, 1, 0, 0, 0),
new Data(9, 1, 1, 1, 0, 1, 0, 1, 0),
new Data(10, 1, 0, 1, 1, 1, 1, 1, 1)};
return dataset;
}//Dataset1
}//Main