Instances filtered = new Instances(toFilter, 0); FastVector nominal_values = new FastVector(m_Clusterer.numberOfClusters()); for (int i=0; i<m_Clusterer.numberOfClusters(); i++) { nominal_values.addElement("cluster" + (i+1));
Instances filtered = new Instances(toFilter, 0); FastVector nominal_values = new FastVector(m_Clusterer.numberOfClusters()); for (int i=0; i<m_Clusterer.numberOfClusters(); i++) { nominal_values.addElement("cluster" + (i+1)); } filtered.insertAttributeAt(new Attribute("cluster", nominal_values), filtered.numAttributes());  setOutputFormat(filtered);
  public boolean batchFinished() throws Exception {    if (getInputFormat() == null) {      throw new IllegalStateException("No input instance format defined");    }    Instances toFilter = getInputFormat();    // filter out attributes if necessary    Instances toFilterIgnoringAttributes = removeIgnored(toFilter);    // build the clusterer    m_Clusterer.buildClusterer(toFilterIgnoringAttributes);    // create output dataset with new attribute    Instances filtered = new Instances(toFilter, 0);     FastVector nominal_values = new FastVector(m_Clusterer.numberOfClusters());    for (int i=0; i<m_Clusterer.numberOfClusters(); i++) {      nominal_values.addElement("cluster" + (i+1));     }    filtered.insertAttributeAt(new Attribute("cluster", nominal_values),			       filtered.numAttributes());    setOutputFormat(filtered);    // build new dataset    for (int i=0; i<toFilter.numInstances(); i++) {      convertInstance(toFilter.instance(i));    }    flushInput();    m_NewBatch = true;    return (numPendingOutput() != 0);  }