Skip to content

Commit 473f867

Browse files
Statistics.countnans: Fix distributions test
1 parent e4206e2 commit 473f867

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Orange/statistics/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def sparse_implicit_zero_weights(x, weights):
4949
if not sp.issparse(x):
5050
raise TypeError('The matrix provided was not sparse.')
5151

52-
x = x.tocsr()
52+
x = x.tocsc()
5353

5454
if weights.ndim == 1:
5555
n_items = np.prod(x.shape)
@@ -101,7 +101,7 @@ def bincount(x, weights=None, max_val=None, minlength=None):
101101
# Store the original matrix before any manipulation to check for sparse
102102
x_original = x
103103
if sp.issparse(x):
104-
x = x.tocsr()
104+
x = x.tocsc()
105105
if weights is not None:
106106
zero_weights = sparse_implicit_zero_weights(x, weights).sum()
107107
weights = weights[x.indices]

Orange/tests/test_distribution.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ def assert_dist_and_unknowns(computed, goal_dist):
363363
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
364364
[0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1.1, 0, 0, 0, 0, 0, 0]]
365365
)
366+
X[0, 0] = 0
367+
366368
d = data.Table.from_numpy(domain, X)
367369
ddist = distribution.get_distributions(d)
368370

0 commit comments

Comments
 (0)