private void updateDistributionProperties(){
  double f=laplaceCorrectionEnabled ? 1 / totalWeight : Double.MIN_VALUE;
  double logFactorCoefficient=Math.sqrt(2 * Math.PI);
  for (int i=0; i < numberOfClasses; i++) {
    priors[i]=Math.log(classWeights[i] / totalWeight);
  }
  for (int i=0; i < numberOfAttributes; i++) {
    if (nominal[i]) {
      for (int j=0; j < numberOfClasses; j++) {
        for (int k=0; k < weightSums[i][j].length; k++) {
          distributionProperties[i][j][k]=Math.log((weightSums[i][j][k] + f) / (classWeights[j] + f * weightSums[i][j].length));
        }
      }
    }
 else {
      for (int j=0; j < numberOfClasses; j++) {
        double classWeight=classWeights[j] - weightSums[i][j][INDEX_MISSING_WEIGHTS];
        distributionProperties[i][j][INDEX_MEAN]=weightSums[i][j][INDEX_VALUE_SUM] / classWeight;
        double standardDeviationSquared=(weightSums[i][j][INDEX_SQUARED_VALUE_SUM] - weightSums[i][j][INDEX_VALUE_SUM] * weightSums[i][j][INDEX_VALUE_SUM] / classWeight) / (classWeight - 1);
        double standardDeviation=1e-3;
        if (standardDeviationSquared > 0) {
          standardDeviation=Math.sqrt(standardDeviationSquared);
          if (Double.isNaN(standardDeviation) || standardDeviation <= 1e-3) {
            standardDeviation=1e-3;
          }
        }
        distributionProperties[i][j][INDEX_STANDARD_DEVIATION]=standardDeviation;
        distributionProperties[i][j][INDEX_LOG_FACTOR]=Math.log(distributionProperties[i][j][INDEX_STANDARD_DEVIATION] * logFactorCoefficient);
      }
    }
  }
  modelRecentlyUpdated=false;
}

private void updateDistributionProperties ( ) { double f = laplaceCorrectionEnabled ? 1 / totalWeight : Double . MIN_VALUE ; double logFactorCoefficient = Math . sqrt ( 2 * Math . PI ) ; for ( int i = 0 ; i < numberOfClasses ; i ++ ) { priors [ i ] = Math . log ( classWeights [ i ] / totalWeight ) ; } for ( int i = 0 ; i < numberOfAttributes ; i ++ ) { if ( nominal [ i ] ) { for ( int j = 0 ; j < numberOfClasses ; j ++ ) { for ( int k = 0 ; k < weightSums [ i ] [ j ] . length ; k ++ ) { distributionProperties [ i ] [ j ] [ k ] = Math . log ( ( weightSums [ i ] [ j ] [ k ] + f ) / ( classWeights [ j ] + f * weightSums [ i ] [ j ] . length ) ) ; } } } else { for ( int j = 0 ; j < numberOfClasses ; j ++ ) { double classWeight = classWeights [ j ] - weightSums [ i ] [ j ] [ INDEX_MISSING_WEIGHTS ] ; distributionProperties [ i ] [ j ] [ INDEX_MEAN ] = weightSums [ i ] [ j ] [ INDEX_VALUE_SUM ] / classWeight ; double standardDeviationSquared = ( weightSums [ i ] [ j ] [ INDEX_SQUARED_VALUE_SUM ] - weightSums [ i ] [ j ] [ INDEX_VALUE_SUM ] * weightSums [ i ] [ j ] [ INDEX_VALUE_SUM ] / classWeight ) / ( classWeight - 1 ) ; double standardDeviation = 1e-3 ; if ( standardDeviationSquared > 0 ) { standardDeviation = Math . sqrt ( standardDeviationSquared ) ; if ( Double . isNaN ( standardDeviation ) || standardDeviation <= 1e-3 ) { standardDeviation = 1e-3 ; } } distributionProperties [ i ] [ j ] [ INDEX_STANDARD_DEVIATION ] = standardDeviation ; distributionProperties [ i ] [ j ] [ INDEX_LOG_FACTOR ] = Math . log ( distributionProperties [ i ] [ j ] [ INDEX_STANDARD_DEVIATION ] * logFactorCoefficient ) ; } } } modelRecentlyUpdated = false ; }
updates the distribution properties by calculating the logged probabilities and distribution parameters on the basis of the weight counters .
