for (int i = 0; i <= m_K; i++) { if (sumSoFar < 0) { output -= m_Weights[i]; } else { output += m_Weights[i]; } if (m_IsAddition[i]) { sumSoFar += innerProduct(m_Train.instance(m_Additions[i]), inst); } else { sumSoFar -= innerProduct(m_Train.instance(m_Additions[i]), inst);
if (m_K > 0) { for (int i = 0; i <= m_K; i++) { if (sumSoFar < 0) { output -= m_Weights[i]; } else { output += m_Weights[i]; } if (m_IsAddition[i]) { sumSoFar += innerProduct(m_Train.instance(m_Additions[i]), inst); } else { sumSoFar -= innerProduct(m_Train.instance(m_Additions[i]), inst); }
  public double[] distributionForInstance(Instance inst) throws Exception {    // Filter instance    m_ReplaceMissingValues.input(inst);    inst = m_ReplaceMissingValues.output();    m_NominalToBinary.input(inst);    inst = m_NominalToBinary.output();        // Get probabilities    double output = 0, sumSoFar = 0;    for (int i = 0; i <= m_K; i++) {      if (sumSoFar < 0) {	output -= m_Weights[i];      } else {	output += m_Weights[i];      }      if (m_IsAddition[i]) {	sumSoFar += innerProduct(m_Train.instance(m_Additions[i]), inst);      } else {	sumSoFar -= innerProduct(m_Train.instance(m_Additions[i]), inst);      }    }    double[] result = new double[2];    result[1] = 1 / (1 + Math.exp(-output));    result[0] = 1 - result[1];    return result;  }