public double logScore(int nType,int nCardinality){
  double fScore=0.0;
switch (nType) {
case (Scoreable.BAYES):
{
      for (int iSymbol=0; iSymbol < m_nSymbols; iSymbol++) {
        fScore+=Statistics.lnGamma(m_Counts[iSymbol]);
      }
      fScore-=Statistics.lnGamma(m_SumOfCounts);
      if (m_fPrior != 0.0) {
        fScore-=m_nSymbols * Statistics.lnGamma(m_fPrior);
        fScore+=Statistics.lnGamma(m_nSymbols * m_fPrior);
      }
    }
  break;
case (Scoreable.BDeu):
{
  for (int iSymbol=0; iSymbol < m_nSymbols; iSymbol++) {
    fScore+=Statistics.lnGamma(m_Counts[iSymbol]);
  }
  fScore-=Statistics.lnGamma(m_SumOfCounts);
  fScore-=m_nSymbols * Statistics.lnGamma(1.0 / (m_nSymbols * nCardinality));
  fScore+=Statistics.lnGamma(1.0 / nCardinality);
}
break;
case (Scoreable.MDL):
case (Scoreable.AIC):
case (Scoreable.ENTROPY):
{
for (int iSymbol=0; iSymbol < m_nSymbols; iSymbol++) {
double fP=getProbability(iSymbol);
fScore+=m_Counts[iSymbol] * Math.log(fP);
}
}
break;
default :
{
}
}
return fScore;
}

public double logScore ( int nType , int nCardinality ) { double fScore = 0.0 ; switch ( nType ) { case ( Scoreable . BAYES ) : { for ( int iSymbol = 0 ; iSymbol < m_nSymbols ; iSymbol ++ ) { fScore += Statistics . lnGamma ( m_Counts [ iSymbol ] ) ; } fScore -= Statistics . lnGamma ( m_SumOfCounts ) ; if ( m_fPrior != 0.0 ) { fScore -= m_nSymbols * Statistics . lnGamma ( m_fPrior ) ; fScore += Statistics . lnGamma ( m_nSymbols * m_fPrior ) ; } } break ; case ( Scoreable . BDeu ) : { for ( int iSymbol = 0 ; iSymbol < m_nSymbols ; iSymbol ++ ) { fScore += Statistics . lnGamma ( m_Counts [ iSymbol ] ) ; } fScore -= Statistics . lnGamma ( m_SumOfCounts ) ; fScore -= m_nSymbols * Statistics . lnGamma ( 1.0 / ( m_nSymbols * nCardinality ) ) ; fScore += Statistics . lnGamma ( 1.0 / nCardinality ) ; } break ; case ( Scoreable . MDL ) : case ( Scoreable . AIC ) : case ( Scoreable . ENTROPY ) : { for ( int iSymbol = 0 ; iSymbol < m_nSymbols ; iSymbol ++ ) { double fP = getProbability ( iSymbol ) ; fScore += m_Counts [ iSymbol ] * Math . log ( fP ) ; } } break ; default : { } } return fScore ; }
gets the log score contribution of this distribution
