} else { System.out.println("The class has been discretized into one interval.");
  public void buildClassifier(Instances instances) throws Exception {    if (!instances.classAttribute().isNumeric()) {      throw new UnsupportedClassTypeException ("Class attribute has to be numeric");    }    // Discretize the training data    m_Discretizer = new Discretize();    m_Discretizer.setBins(m_NumBins);    if (m_OptimizeBins) {      m_Discretizer.setFindNumBins(true);    }    m_Discretizer.setAttributeIndices(""+ (instances.classIndex() + 1));    m_Discretizer.setInputFormat(instances);    Instances newTrain = Filter.useFilter(instances, m_Discretizer);    int numClasses = newTrain.numClasses();    // Calculate the mean value for each bin of the new class attribute    m_ClassMeans = new double [numClasses];    int [] classCounts = new int [numClasses];    for (int i = 0; i < instances.numInstances(); i++) {      int classVal = (int) newTrain.instance(i).classValue();      classCounts[classVal]++;      m_ClassMeans[classVal] += instances.instance(i).classValue();    }    for (int i = 0; i < numClasses; i++) {      if (classCounts[i] > 0) {	m_ClassMeans[i] /= classCounts[i];      }    }    if (m_Debug) {      System.out.println("Boundaries    Bin Mean");      System.out.println("======================");      System.out.println("-infinity");      double [] cutPoints = m_Discretizer.getCutPoints(instances.classIndex());      if (cutPoints != null) {	for (int i = 0; i < cutPoints.length; i++) {	  System.out.println("              " + m_ClassMeans[i]);	  System.out.println("" + cutPoints[i]);	}      }      System.out.println("              " 			 + m_ClassMeans[m_ClassMeans.length - 1]);      System.out.println("infinity");    }    // Train the sub-classifier    m_Classifier.buildClassifier(newTrain);  }