throw new Exception("Can't handle numeric attributes!  Descritize the dataset prior to using Lazy Bayesian Rules or use the Filtered Classifier");
throw new Exception("Can't handle numeric attributes!  Discretize the dataset prior to using Lazy Bayesian Rules or use the Filtered Classifier");
  public void buildClassifier(Instances instances) throws Exception {    int attIndex, i, j;    bestCnt = 0;    tempCnt = 0;    forCnt = 0;    whileCnt = 0;        m_numAtts = instances.numAttributes();    // LBR requires nominal attibutes    for (attIndex = 0; attIndex < m_numAtts; attIndex++) {      Attribute attribute = (Attribute) instances.attribute(attIndex);      if (attribute.isNumeric()) {        throw new Exception("Can't handle numeric attributes!  Descritize the dataset prior to using Lazy Bayesian Rules or use the Filtered Classifier");      }    }    if (instances.classAttribute().isNumeric()) {      throw new Exception("LBR: Class is numeric!");    }    m_numClasses = instances.numClasses();    if (m_numClasses < 0) {      throw new Exception ("Dataset has no class attribute");    }    m_numInsts = instances.numInstances();    // Reserve space    m_Counts = new int[m_numClasses][m_numAtts][0];    m_Priors = new int[m_numClasses];    m_tCounts = new int[m_numClasses][m_numAtts][0];    m_tPriors = new int[m_numClasses];    m_subOldErrorFlags = new boolean[m_numInsts+1];        m_Instances = instances;        m_subInstances = new Indexes(m_numInsts, m_numAtts, true, m_Instances.classIndex());    tempSubInstances = new Indexes(m_numInsts, m_numAtts, true, m_Instances.classIndex());            posteriorsArray = new double[m_numClasses];        // prepare arrays    for (attIndex = 0; attIndex < m_numAtts; attIndex++) {      Attribute attribute = (Attribute) instances.attribute(attIndex);      for (j = 0; j < m_numClasses; j++) {        m_Counts[j][attIndex] = new int[attribute.numValues()];        m_tCounts[j][attIndex] = new int[attribute.numValues()];      }    }    // Compute counts and priors    for(i = 0; i < m_numInsts; i++) {      Instance instance = (Instance) instances.instance(i);      int classValue = (int)instance.classValue();      // pointer for more efficient access to counts matrix in loop      int [][] countsPointer = m_tCounts[classValue];      for(attIndex = 0; attIndex < m_numAtts; attIndex++) {        countsPointer[attIndex][(int)instance.value(attIndex)]++;      }      m_tPriors[classValue]++;    }        // Step 2: Leave-one-out on the training data set.    // get m_Errors and its flags array using leave-one-out.    m_ErrorFlags = new boolean[m_numInsts];        m_Errors = leaveOneOut(m_subInstances, m_tCounts, m_tPriors, m_ErrorFlags);    if (m_Number == 0) {      m_NumberOfInstances = m_Instances.numInstances();    } else {      System.out.println(" ");      System.out.println("N-Fold Cross Validation: ");      m_NCV = true;    }  }