From da15977e0c0156e5c0c0bbfaa52a2d2aa15a239e Mon Sep 17 00:00:00 2001 From: geb <853934146@qq.com> Date: Mon, 19 Oct 2020 15:22:34 +0800 Subject: [PATCH] fix error in export java code --- .../classifier/BernoulliNB/templates/java/exported.class.txt | 2 +- .../BernoulliNB/templates/java/separated.method.predict.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; }}