Package weka.clusterers

Examples of weka.clusterers.HierarchicalClusterer$TupleComparator


  }

  @Override
  public ClusteringResult performClustering(Instances dataset,
      ParameterSet parameters) {
    HierarchicalClusterer clusterer = new HierarchicalClusterer();
    String[] options = new String[5];
    LinkType link = parameters.getParameter(
        HierarClustererParameters.linkType).getValue();
    DistanceType distanceType = parameters.getParameter(
        HierarClustererParameters.distanceType).getValue();
    options[0] = "-L";
    options[1] = link.name();
    options[2] = "-A";
    switch (distanceType) {
      case EUCLIDIAN :
        options[3] = "weka.core.EuclideanDistance";
        break;
      case CHEBYSHEV :
        options[3] = "weka.core.ChebyshevDistance";
        break;
      case MANHATTAN :
        options[3] = "weka.core.ManhattanDistance";
        break;
      case MINKOWSKI :
        options[3] = "weka.core.MinkowskiDistance";
        break;
    }

    options[4] = "-P";
    try {
      clusterer.setOptions(options);
      clusterer.setPrintNewick(true);
      clusterer.buildClusterer(dataset);
      // clusterer.graph() gives only the first cluster and in the case
      // there
      // are more than one cluster the variables in the second cluster are
      // missing.
      // I'm using clusterer.toString() which contains all the clusters in
      // Newick format.
      ClusteringResult result = new ClusteringResult(null,
          clusterer.toString(), clusterer.getNumClusters(), null);
      return result;
    } catch (Exception ex) {
      logger.log(Level.SEVERE, null, ex);
      return null;
    }
View Full Code Here

TOP

Related Classes of weka.clusterers.HierarchicalClusterer$TupleComparator

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.