Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.4
-
None
-
Important
Description
the trainingStats function in NaiveBayesTrainer class is not working properly and display wrong result.
In findParameters(), at line 154 i.e.
EvalParameters evalParams = new EvalParameters(params, numOutcomes);
should be replaced by following block:
double[] outcomeTotals = new double[outcomeLabels.length];
for (int i = 0; i < params.length; ++i) {
Context context = params[i];
for (int j = 0; j < context.getOutcomes().length; ++j)
{ int outcome = context.getOutcomes()[j]; double count = context.getParameters()[j]; outcomeTotals[outcome] += count; }}
evalParams = new NaiveBayesEvalParameters(params,
outcomeLabels.length, outcomeTotals, predLabels.length);