diff --git a/src/main/java/de/hsel/spm/baudas/analysis/Cluster.java b/src/main/java/de/hsel/spm/baudas/analysis/Cluster.java index d340747..10e25b1 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/Cluster.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/Cluster.java @@ -10,7 +10,7 @@ import java.util.HashMap; import java.util.Map; /** - * Cluster Analysis + * Cluster Analysis. * * @author Johannes Theiner * @version 0.1 @@ -24,6 +24,11 @@ public class Cluster implements Analysis>> { instances = load(file); } + /** + * get result of cluster analysis. + * + * @return Result + */ @Override public Map> getResult() { if(result == null) { @@ -41,6 +46,7 @@ public class Cluster implements Analysis>> { e.printStackTrace(); } + //creating a single cluster to get average, weka has no way to get that from a bigger one. SimpleKMeans fullMeans = new SimpleKMeans(); Instances fullCentroids = null; try { @@ -54,6 +60,7 @@ public class Cluster implements Analysis>> { } assert fullCentroids != null; + //creating real cluster SimpleKMeans kMeans = new SimpleKMeans(); try { kMeans.setNumClusters(5); @@ -70,10 +77,16 @@ public class Cluster implements Analysis>> { ex.printStackTrace(); } } - return result; } + /** + * puts data into map. + * + * @param centroids cluster analysis result + * @param count current insert count + * @return count increment + */ private int putIntoMap(Instances centroids, int count) { for (int i = 0; i < centroids.numInstances(); i++) { Map map = new HashMap<>();