title: Simple K-Means doesnt handle iris.arff
body: <p>I have this class below, i build it considering the examples given on the wiki and in a thesis, why can't SympleKMeans handle data? The class can print the Datasource dados, so its nothing wrong with processing file, the error is on the build.</p>
  
  <pre><code>package slcct;
  
  import weka.clusterers.ClusterEvaluation;
  import weka.clusterers.SimpleKMeans;
  import weka.core.Instance;
  import weka.core.Instances;
  import weka.core.converters.ConverterUtils.DataSource;
  
  
  public class Cluster {
  
  public String path;
  public Instances dados;
  public String[] options = new String[2];
  
  public Cluster(String caminho, int nclusters, int seed ){
      this.path = caminho;
      this.options[0] = String.valueOf(nclusters);
      this.options[1] = String.valueOf(seed);
  
  }
  
  public void ledados() throws Exception{
  
      DataSource source = new DataSource(path);
      dados = source.getDataSet();
      System.out.println(dados)
  
      if(dados.classIndex()==-1){
          dados.setClassIndex(dados.numAttributes()-1);
      }
  }
  
  public void imprimedados(){
      for(int i=0; i&lt;dados.numInstances();i++)
      {
          Instance actual = dados.instance(i);
          System.out.println((i+1) + " : "+ actual);
      }
  }
  
  public void clustering() throws Exception{
  
      SimpleKMeans cluster = new SimpleKMeans();
      cluster.setOptions(options);
      cluster.setDisplayStdDevs(true);
      cluster.getMaxIterations();
      cluster.buildClusterer(dados);
  
      Instances ClusterCenter = cluster.getClusterCentroids();
      Instances SDev = cluster.getClusterStandardDevs();
      int[] ClusterSize = cluster.getClusterSizes(); 
  
      ClusterEvaluation eval = new ClusterEvaluation();
      eval.setClusterer(cluster);
      eval.evaluateClusterer(dados);
  
      for(int i=0;i&lt;ClusterCenter.numInstances();i++){
          System.out.println("Cluster#"+( i +1)+ ": "+ClusterSize[i]+" dados .");
          System.out.println("Centróide:"+ ClusterCenter.instance(i));
          System.out.println("STDDEV:" + SDev.instance(i));
          System.out.println("Cluster Evaluation:"+eval.clusterResultsToString());
  
      }
  
  }
  }
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>weka.core.WekaException: weka.clusterers.SimpleKMeans: Cannot handle any class attribute!
  
  at weka.core.Capabilities.test(Capabilities.java:1097)    
  at weka.core.Capabilities.test(Capabilities.java:1018)   
  at weka.core.Capabilities.testWithFail(Capabilities.java:1297) 
  at weka.clusterers.SimpleKMeans.buildClusterer(SimpleKMeans.java:228)    
  at slcct.Cluster.clustering(Cluster.java:53)//Here.    
  at slcct.Clustering.jButton1ActionPerformed(Clustering.java:104)
  </code></pre>