m_priors[1] = 1;
m_priors[0] = 1;
  public boolean batchFinished() throws Exception {    if (getInputFormat() == null) {      throw new IllegalStateException("No input instance format defined");    }    if (outputFormatPeek() == null) {      Instances toFilter = getInputFormat();      Instances[] toFilterIgnoringAttributes;      // Make subsets if class is nominal      if ((toFilter.classIndex() >= 0) && toFilter.classAttribute().isNominal()) {	toFilterIgnoringAttributes = new Instances[toFilter.numClasses()];	for (int i = 0; i < toFilter.numClasses(); i++) {	  toFilterIgnoringAttributes[i] = new Instances(toFilter, toFilter.numInstances());	}	for (int i = 0; i < toFilter.numInstances(); i++) {	  toFilterIgnoringAttributes[(int)toFilter.instance(i).classValue()].add(toFilter.instance(i));	}	m_priors = new double[toFilter.numClasses()];	for (int i = 0; i < toFilter.numClasses(); i++) {	  toFilterIgnoringAttributes[i].compactify();	  m_priors[i] = toFilterIgnoringAttributes[i].sumOfWeights();	}	Utils.normalize(m_priors);      } else {	toFilterIgnoringAttributes = new Instances[1];	toFilterIgnoringAttributes[0] = toFilter;	m_priors = new double[1];	m_priors[1] = 1;      }      // filter out attributes if necessary      if (m_ignoreAttributesRange != null || toFilter.classIndex() >= 0) {	m_removeAttributes = new Remove();	String rangeString = "";	if (m_ignoreAttributesRange != null) {	  rangeString += m_ignoreAttributesRange.getRanges();	}	if (toFilter.classIndex() >= 0) {	  if (rangeString.length() > 0) {	    rangeString += (","+(toFilter.classIndex()+1));	  	  } else {	    rangeString = ""+(toFilter.classIndex()+1);	  }	}	((Remove)m_removeAttributes).setAttributeIndices(rangeString);	((Remove)m_removeAttributes).setInvertSelection(false);	((Remove)m_removeAttributes).setInputFormat(toFilter);	for (int i = 0; i < toFilterIgnoringAttributes.length; i++) {	  toFilterIgnoringAttributes[i] = Filter.useFilter(toFilterIgnoringAttributes[i],							   m_removeAttributes);	}      }           // build the clusterers      if ((toFilter.classIndex() <= 0) || !toFilter.classAttribute().isNominal()) {	m_clusterers = DensityBasedClusterer.makeCopies(m_clusterer, 1);	m_clusterers[0].buildClusterer(toFilterIgnoringAttributes[0]);      } else {	m_clusterers = DensityBasedClusterer.makeCopies(m_clusterer, toFilter.numClasses());	for (int i = 0; i < m_clusterers.length; i++) {	  if (toFilterIgnoringAttributes[i].numInstances() == 0) {	    m_clusterers[i] = null;	  } else {	    m_clusterers[i].buildClusterer(toFilterIgnoringAttributes[i]);	  }	}      }            // create output dataset      FastVector attInfo = new FastVector();      for (int j = 0; j < m_clusterers.length; j++) {	if (m_clusterers[j] != null) {	  for (int i = 0; i < m_clusterers[j].numberOfClusters(); i++) {	    attInfo.addElement(new Attribute("pCluster_" + j + "_" + i));	  }	}      }      if (toFilter.classIndex() >= 0) {	attInfo.addElement(toFilter.classAttribute().copy());      }      attInfo.trimToSize();      Instances filtered = new Instances(toFilter.relationName()+"_clusterMembership",					 attInfo, 0);      if (toFilter.classIndex() >= 0) {	filtered.setClassIndex(filtered.numAttributes() - 1);      }      setOutputFormat(filtered);      // build new dataset      for (int i = 0; i < toFilter.numInstances(); i++) {	convertInstance(toFilter.instance(i));      }    }    flushInput();    m_NewBatch = true;    return (numPendingOutput() != 0);  }