public ClusteringResult performClustering(Instances dataset,
ParameterSet parameters) {
List<Integer> clusters = new ArrayList<Integer>();
String[] options = new String[2];
SimpleKMeans clusterer = new SimpleKMeans();
int numberOfGroups = parameters.getParameter(
SimpleKMeansClustererParameters.numberOfGroups).getValue();
options[0] = "-N";
options[1] = String.valueOf(numberOfGroups);
try {
clusterer.setOptions(options);
clusterer.buildClusterer(dataset);
Enumeration e = dataset.enumerateInstances();
while (e.hasMoreElements()) {
clusters.add(clusterer.clusterInstance((Instance) e
.nextElement()));
}
ClusteringResult result = new ClusteringResult(clusters, null,
clusterer.numberOfClusters(), parameters.getParameter(
EMClustererParameters.visualization).getValue());
return result;
} catch (Exception ex) {
logger.log(Level.SEVERE, null, ex);