m_attScores = new double[data.numAttributes() - 1];
m_attScores = new double[data.numAttributes()];
  public void buildEvaluator(Instances data) throws Exception {        if (data.checkForStringAttributes()) {      throw  new Exception("Can't handle string attributes!");    }        if (!data.classAttribute().isNominal()) {      throw new Exception("Class must be nominal!");    }        if (data.classAttribute().numValues() != 2) {      throw new Exception("Can only deal with binary class problems!");    }        // Holds a mapping into the original array of attribute indices    int[] origIndices = new int[data.numAttributes()];    for (int i = 0; i < origIndices.length; i++) {      if (data.attribute(i).isNominal() && 	  (data.attribute(i).numValues() != 2)) {	throw new Exception("All nominal attributes must be binary!");      }      origIndices[i] = i;    }        // We need to repeat the following loop until we've computed    // a weight for every attribute (excluding the class).    m_attScores = new double[data.numAttributes() - 1];    Instances trainCopy = new Instances(data);    //    for (int i = 0; i < m_attScores.length; i++) {    int i = 0;    do {      int numToElim = (m_attScores.length - i >= m_numToEliminate)	? m_numToEliminate	: m_attScores.length - i;            // Build the linear SVM with default parameters      SMO smo = new SMO();      smo.setC(m_smoCParameter);      smo.buildClassifier(trainCopy);      // Find the attribute with maximum weight^2      FastVector weightsAndIndices = smo.weights();      double[] weightsSparse = (double[])weightsAndIndices.elementAt(0);      int[] indicesSparse = (int[])weightsAndIndices.elementAt(1);      double[] weights = new double[trainCopy.numAttributes()];      for (int j = 0; j < weightsSparse.length; j++) {	weights[indicesSparse[j]] = weightsSparse[j] * weightsSparse[j];      }      weights[trainCopy.classIndex()] = Double.MAX_VALUE;      int minWeightIndex;      int[] featArray = new int[numToElim];      boolean [] eliminated = new boolean [origIndices.length];      for (int j = 0; j <numToElim; j++) {	minWeightIndex = Utils.minIndex(weights);	m_attScores[origIndices[minWeightIndex]] = i+j+1;	featArray[j] = minWeightIndex;	eliminated[minWeightIndex] = true;	weights[minWeightIndex] = Double.MAX_VALUE;      }            // Delete the best attribute.       AttributeFilter delTransform = new AttributeFilter();      delTransform.setInvertSelection(false);      delTransform.setAttributeIndicesArray(featArray);      delTransform.setInputFormat(trainCopy);      trainCopy = Filter.useFilter(trainCopy, delTransform);            // Update the array of indices      int[] temp = new int[origIndices.length - numToElim];      int k = 0;      for (int j = 0; j < origIndices.length; j++) {	if (!eliminated[j]) {	  temp[k++] = origIndices[j];	}      }      origIndices = temp;      i += numToElim;    } while (i < m_attScores.length);  }