Package weka.clusterers

Examples of weka.clusterers.FarthestFirst


  public ClusteringResult performClustering(Instances dataset,
      ParameterSet parameters) {

    List<Integer> clusters = new ArrayList<Integer>();
    String[] options = new String[2];
    FarthestFirst clusterer = new FarthestFirst();

    int numberOfGroups = parameters.getParameter(
        FarthestFirstClustererParameters.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);
      return null;
View Full Code Here

TOP

Related Classes of weka.clusterers.FarthestFirst

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.