ca.pfv.spmf.algorithms.clustering.hierarchical_clustering
Class AlgoHierarchicalClustering
- java.lang.Object
-
- ca.pfv.spmf.algorithms.clustering.hierarchical_clustering.AlgoHierarchicalClustering
-
public class AlgoHierarchicalClustering extends java.lang.ObjectThis is an implementation of generic Hierarchical Clustering Algorithm as described in this webpage: http://home.dei.polimi.it/matteucc/Clustering/tutorial_html/hierarchical.html
This is a Hierarchical Clustering with a constant "threshold" that indicate the maximal distance between two clusters to group them. The algorithm stops when no cluster can be merged.
The distance between two clusters is calculated as the distance between the medians of the two clusters.
-
-
Constructor Summary
Constructors Constructor and Description AlgoHierarchicalClustering()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidprintStatistics()Print statistics about the latest execution to System.out.java.util.List<Cluster>runAlgorithm(java.lang.String inputFile, double maxDistance)Run the algorithm.voidsaveToFile(java.lang.String output)Save the clusters to an output file
-
-
-
Constructor Detail
-
AlgoHierarchicalClustering
public AlgoHierarchicalClustering()
Default constructor
-
-
Method Detail
-
runAlgorithm
public java.util.List<Cluster> runAlgorithm(java.lang.String inputFile, double maxDistance) throws java.lang.NumberFormatException, java.io.IOException
Run the algorithm.- Parameters:
inputFile- an input file containing vectors of doublesmaxDistance- the maximum distance allowed for merging two clusters- Returns:
- a list of Clusters
- Throws:
java.io.IOException- exception if error while reading the filejava.lang.NumberFormatException
-
saveToFile
public void saveToFile(java.lang.String output) throws java.io.IOExceptionSave the clusters to an output file- Parameters:
output- the output file path- Throws:
java.io.IOException- exception if there is some writing error.
-
printStatistics
public void printStatistics()
Print statistics about the latest execution to System.out.
-
-
DMelt 3.0 © DataMelt by jWork.ORG