Double value = new Double(dv);  result[current++] = value;
if (!Instance.isMissingValue(dv)) { Double value = new Double(dv); result[current++] = value; } else { result[current++] = null; }
  public Object [] getResult(Instances train, Instances test)     throws Exception {        if (train.classAttribute().type() != Attribute.NOMINAL) {      throw new Exception("Class attribute is not nominal!");    }    if (m_Template == null) {      throw new Exception("No classifier has been specified");    }    int addm = (m_AdditionalMeasures != null)       ? m_AdditionalMeasures.length       : 0;    int overall_length = RESULT_SIZE+addm;    overall_length += NUM_IR_STATISTICS;    if (getAttributeID() >= 0) overall_length += 1;    if (getPredTargetColumn()) overall_length += 2;    Object [] result = new Object[overall_length];    Evaluation eval = new Evaluation(train);    m_Classifier = Classifier.makeCopy(m_Template);    long trainTimeStart = System.currentTimeMillis();    m_Classifier.buildClassifier(train);    long trainTimeElapsed = System.currentTimeMillis() - trainTimeStart;    long testTimeStart = System.currentTimeMillis();    double predictions[] = eval.evaluateModel(m_Classifier, test);    long testTimeElapsed = System.currentTimeMillis() - testTimeStart;    m_result = eval.toSummaryString();    // The results stored are all per instance -- can be multiplied by the    // number of instances to get absolute numbers    int current = 0;    result[current++] = new Double(train.numInstances());    result[current++] = new Double(eval.numInstances());    result[current++] = new Double(eval.correct());    result[current++] = new Double(eval.incorrect());    result[current++] = new Double(eval.unclassified());    result[current++] = new Double(eval.pctCorrect());    result[current++] = new Double(eval.pctIncorrect());    result[current++] = new Double(eval.pctUnclassified());    result[current++] = new Double(eval.kappa());    result[current++] = new Double(eval.meanAbsoluteError());    result[current++] = new Double(eval.rootMeanSquaredError());    result[current++] = new Double(eval.relativeAbsoluteError());    result[current++] = new Double(eval.rootRelativeSquaredError());    result[current++] = new Double(eval.SFPriorEntropy());    result[current++] = new Double(eval.SFSchemeEntropy());    result[current++] = new Double(eval.SFEntropyGain());    result[current++] = new Double(eval.SFMeanPriorEntropy());    result[current++] = new Double(eval.SFMeanSchemeEntropy());    result[current++] = new Double(eval.SFMeanEntropyGain());    // K&B stats    result[current++] = new Double(eval.KBInformation());    result[current++] = new Double(eval.KBMeanInformation());    result[current++] = new Double(eval.KBRelativeInformation());    // IR stats    result[current++] = new Double(eval.truePositiveRate(m_IRclass));    result[current++] = new Double(eval.numTruePositives(m_IRclass));    result[current++] = new Double(eval.falsePositiveRate(m_IRclass));    result[current++] = new Double(eval.numFalsePositives(m_IRclass));    result[current++] = new Double(eval.trueNegativeRate(m_IRclass));    result[current++] = new Double(eval.numTrueNegatives(m_IRclass));    result[current++] = new Double(eval.falseNegativeRate(m_IRclass));    result[current++] = new Double(eval.numFalseNegatives(m_IRclass));    result[current++] = new Double(eval.precision(m_IRclass));    result[current++] = new Double(eval.recall(m_IRclass));    result[current++] = new Double(eval.fMeasure(m_IRclass));    // Timing stats    result[current++] = new Double(trainTimeElapsed / 1000.0);    result[current++] = new Double(testTimeElapsed / 1000.0);    // IDs    if (getAttributeID() >= 0){        String idsString = "";        if (test.attribute(m_attID).isNumeric()){            if (test.numInstances() > 0)                idsString += test.instance(0).value(m_attID);            for(int i=1;i<test.numInstances();i++){                idsString += "|" + test.instance(i).value(m_attID);            }        } else {            if (test.numInstances() > 0)                idsString += test.instance(0).stringValue(m_attID);            for(int i=1;i<test.numInstances();i++){                idsString += "|" + test.instance(i).stringValue(m_attID);            }        }        result[current++] = idsString;    }        if (getPredTargetColumn()){        if (test.classAttribute().isNumeric()){            // Targets            if (test.numInstances() > 0){                String targetsString = "";                targetsString += test.instance(0).value(test.classIndex());                for(int i=1;i<test.numInstances();i++){                    targetsString += "|" + test.instance(i).value(test.classIndex());                }                result[current++] = targetsString;            }                // Predictions            if (predictions.length > 0){                 String predictionsString = "";                predictionsString += predictions[0];                for(int i=1;i<predictions.length;i++){                    predictionsString += "|" + predictions[i];                }                result[current++] = predictionsString;            }                    } else {            // Targets            if (test.numInstances() > 0){                String targetsString = "";                targetsString += test.instance(0).stringValue(test.classIndex());                for(int i=1;i<test.numInstances();i++){                    targetsString += "|" + test.instance(i).stringValue(test.classIndex());                }                result[current++] = targetsString;            }                // Predictions            if (predictions.length > 0){                 String predictionsString = "";                predictionsString += test.classAttribute().value((int) predictions[0]);                for(int i=1;i<predictions.length;i++){                    predictionsString += "|" + test.classAttribute().value((int) predictions[i]);                }                result[current++] = predictionsString;            }        }    }        if (m_Classifier instanceof Summarizable) {      result[current++] = ((Summarizable)m_Classifier).toSummaryString();    } else {      result[current++] = null;    }    for (int i=0;i<addm;i++) {      if (m_doesProduce[i]) {	try {	  double dv = ((AdditionalMeasureProducer)m_Classifier).	    getMeasure(m_AdditionalMeasures[i]);	  Double value = new Double(dv);	  result[current++] = value;	} catch (Exception ex) {	  System.err.println(ex);	}      } else {	result[current++] = null;      }    }    if (current != overall_length) {      throw new Error("Results didn't fit RESULT_SIZE");    }    return result;  }