public double[] distributionForInstance(Instance inst) throws Exception {
  m_ReplaceMissingValues.input(inst);
  m_ReplaceMissingValues.batchFinished();
  inst=m_ReplaceMissingValues.output();
  m_NominalToBinary.input(inst);
  m_NominalToBinary.batchFinished();
  inst=m_NominalToBinary.output();
  double output=0, sumSoFar=0;
  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);
      }
    }
  }
  double[] result=new double[2];
  result[1]=1 / (1 + Math.exp(-output));
  result[0]=1 - result[1];
  return result;
}

public double [ ] distributionForInstance ( Instance inst ) throws Exception { m_ReplaceMissingValues . input ( inst ) ; m_ReplaceMissingValues . batchFinished ( ) ; inst = m_ReplaceMissingValues . output ( ) ; m_NominalToBinary . input ( inst ) ; m_NominalToBinary . batchFinished ( ) ; inst = m_NominalToBinary . output ( ) ; double output = 0 , sumSoFar = 0 ; 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 ) ; } } } double [ ] result = new double [ 2 ] ; result [ 1 ] = 1 / ( 1 + Math . exp ( - output ) ) ; result [ 0 ] = 1 - result [ 1 ] ; return result ; }
outputs the distribution for the given output . pipes output of svm through sigmoid function .
