Package weka.clusterers

Examples of weka.clusterers.EM


  /**
   * returns a configured cluster algorithm
   */
  protected Clusterer getClusterer() {
    EM c = new EM();
    try {
      c.setOptions(new String[0]);
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    return c;
View Full Code Here


        Filter filter = aset.createFilter(trainingData);
       
        // Using our training set to build the clusterer
        int seed = this.rand.nextInt();
//        SimpleKMeans inner_clusterer = new SimpleKMeans();
        EM inner_clusterer = new EM();
        String options[] = {
            "-N", Integer.toString(1000), // num_partitions),
            "-S", Integer.toString(seed),
            "-I", Integer.toString(100),
           
        };
        inner_clusterer.setOptions(options);
       
        FilteredClusterer filtered_clusterer = new FilteredClusterer();
        filtered_clusterer.setFilter(filter);
        filtered_clusterer.setClusterer(inner_clusterer);
       
View Full Code Here

  public ClusteringResult performClustering(Instances dataset,
      ParameterSet parameters) {

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

    int numberOfIterations = parameters.getParameter(
        EMClustererParameters.numberOfIterations).getValue();
    options[0] = "-I";
    options[1] = String.valueOf(numberOfIterations);

    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);
View Full Code Here

TOP

Related Classes of weka.clusterers.EM

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.