diff --git a/sklearn_porter/estimator/classifier/BernoulliNB/templates/java/exported.class.txt b/sklearn_porter/estimator/classifier/BernoulliNB/templates/java/exported.class.txt index cbef2454..a2c21350 100644 --- a/sklearn_porter/estimator/classifier/BernoulliNB/templates/java/exported.class.txt +++ b/sklearn_porter/estimator/classifier/BernoulliNB/templates/java/exported.class.txt @@ -27,7 +27,7 @@ class {class_name} {{ for (int i = 0; i < nClasses; i++) {{ double sum = 0.; for (int j = 0; j < nFeatures; j++) {{ - sum += features[i] * this.clf.delProbs[j][i]; + sum += features[j] * this.clf.delProbs[j][i]; }} jll[i] = sum; }} diff --git a/sklearn_porter/estimator/classifier/BernoulliNB/templates/java/separated.method.predict.txt b/sklearn_porter/estimator/classifier/BernoulliNB/templates/java/separated.method.predict.txt index 22f6b84e..6ab293b5 100644 --- a/sklearn_porter/estimator/classifier/BernoulliNB/templates/java/separated.method.predict.txt +++ b/sklearn_porter/estimator/classifier/BernoulliNB/templates/java/separated.method.predict.txt @@ -6,7 +6,7 @@ public int {method_name}(double[] features) {{ for (int i = 0; i < nClasses; i++) {{ double sum = 0.; for (int j = 0; j < nFeatures; j++) {{ - sum += features[i] * this.delProbs[j][i]; + sum += features[j] * this.delProbs[j][i]; }} jll[i] = sum; }}