net.sf.javaml.clustering.Clusterer Java Examples

The following examples show how to use net.sf.javaml.clustering.Clusterer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaMLClusterers.java    From apogen with Apache License 2.0 5 votes vote down vote up
public static LinkedHashMap<Integer, LinkedList<String>> runKmedoid(String filename, String numClusters,
		boolean distance) throws IOException {

	LinkedHashMap<Integer, LinkedList<String>> output = null;
	Clusterer c = new KMedoids(Integer.parseInt(numClusters), 500, new EuclideanDistance());

	// if (distance) {
	//// c = new KMedoidsDistance(Integer.parseInt(numClusters), 500,
	//// new EuclideanDistance());
	// c = new KMedoids(Integer.parseInt(numClusters), 500, new
	// EuclideanDistance());
	// } else {
	// c = new KMedoids(Integer.parseInt(numClusters), 500,
	// new EuclideanDistance());
	// }

	Dataset data = FileHandler.loadDataset(new File(filename), 0, ",");

	Dataset[] clusters = c.cluster(data);

	output = convert(clusters);

	return output;

}