private double[] evaluateProbability(double[] data){
  double[] prob=new double[m_NumClasses], v=new double[m_NumClasses];
  for (int j=0; j < m_NumClasses - 1; j++) {
    for (int k=0; k <= m_NumPredictors; k++) {
      v[j]+=m_Par[k][j] * data[k];
    }
  }
  v[m_NumClasses - 1]=0;
  for (int m=0; m < m_NumClasses; m++) {
    double sum=0;
    for (int n=0; n < m_NumClasses - 1; n++) {
      sum+=Math.exp(v[n] - v[m]);
    }
    prob[m]=1 / (sum + Math.exp(-v[m]));
  }
  return prob;
}

private double [ ] evaluateProbability ( double [ ] data ) { double [ ] prob = new double [ m_NumClasses ] , v = new double [ m_NumClasses ] ; for ( int j = 0 ; j < m_NumClasses - 1 ; j ++ ) { for ( int k = 0 ; k <= m_NumPredictors ; k ++ ) { v [ j ] += m_Par [ k ] [ j ] * data [ k ] ; } } v [ m_NumClasses - 1 ] = 0 ; for ( int m = 0 ; m < m_NumClasses ; m ++ ) { double sum = 0 ; for ( int n = 0 ; n < m_NumClasses - 1 ; n ++ ) { sum += Math . exp ( v [ n ] - v [ m ] ) ; } prob [ m ] = 1 / ( sum + Math . exp ( - v [ m ] ) ) ; } return prob ; }
compute the posterior distribution using optimized parameter values and the testing instance .
