Skip to content

Commit 72b2f9c

Browse files
committed
Naive Bayes: Fix deprecated calling np.sum with generator
1 parent e9d4e93 commit 72b2f9c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Orange/classification/naive_bayes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ def predict_storage(self, data):
5757
np.log(self.class_prob) +
5858
np.array([np.zeros_like(self.class_prob)
5959
if isnan(ins.x).all() else
60-
np.sum(attr_prob[:, int(attr_val)]
61-
for attr_val, attr_prob in zip(ins, self.log_cont_prob)
62-
if not isnan(attr_val))
60+
np.sum([attr_prob[:, int(attr_val)]
61+
for attr_val, attr_prob in
62+
zip(ins, self.log_cont_prob)
63+
if not isnan(attr_val)], axis=0)
6364
for ins in data]))
6465
probs /= probs.sum(axis=1)[:, None]
6566
values = probs.argmax(axis=1)

0 commit comments

Comments
 (0)