double output = m_classifiers[i][j].SVMOutput(-1, inst); if (output > 0) { result[j] += 1; } else { result[i] += 1;
if ((m_classifiers[i][j].m_alpha != null) || (m_classifiers[i][j].m_sparseWeights != null)) { double output = m_classifiers[i][j].SVMOutput(-1, inst); if (output > 0) { result[j] += 1; } else { result[i] += 1; }
  public double[] distributionForInstance(Instance inst) throws Exception {    // Filter instance    if (!m_checksTurnedOff) {      m_Missing.input(inst);      m_Missing.batchFinished();      inst = m_Missing.output();    }    if (!m_onlyNumeric) {      m_NominalToBinary.input(inst);      m_NominalToBinary.batchFinished();      inst = m_NominalToBinary.output();    }        if (m_Filter != null) {      m_Filter.input(inst);      m_Filter.batchFinished();      inst = m_Filter.output();    }        if (!m_fitLogisticModels) {      double[] result = new double[inst.numClasses()];      for (int i = 0; i < inst.numClasses(); i++) {	for (int j = i + 1; j < inst.numClasses(); j++) {	  double output = m_classifiers[i][j].SVMOutput(-1, inst);	  if (output > 0) {	    result[j] += 1;	  } else {	    result[i] += 1;	  }	}       }      Utils.normalize(result);      return result;    } else {      // We only need to do pairwise coupling if there are more      // then two classes.      if (inst.numClasses() == 2) {	double[] newInst = new double[2];	newInst[0] = m_classifiers[0][1].SVMOutput(-1, inst);	newInst[1] = Instance.missingValue();	return m_classifiers[0][1].m_logistic.	  distributionForInstance(new Instance(1, newInst));      }      double[][] r = new double[inst.numClasses()][inst.numClasses()];      double[][] n = new double[inst.numClasses()][inst.numClasses()];      for (int i = 0; i < inst.numClasses(); i++) {	for (int j = i + 1; j < inst.numClasses(); j++) {	  double[] newInst = new double[2];	  newInst[0] = m_classifiers[i][j].SVMOutput(-1, inst);	  newInst[1] = Instance.missingValue();	  r[i][j] = m_classifiers[i][j].m_logistic.	    distributionForInstance(new Instance(1, newInst))[0];	  n[i][j] = m_classifiers[i][j].m_sumOfWeights;	}      }      return pairwiseCoupling(n, r);    }  }