Skip to content

Commit b5b4cdc

Browse files
Statistics.sparse_zero_weights: Add dimension check
1 parent e4206e2 commit b5b4cdc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Orange/statistics/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def sparse_implicit_zero_weights(x, weights):
5252
x = x.tocsr()
5353

5454
if weights.ndim == 1:
55+
assert x.shape[1] == weights.shape[0], '`weight` shape does not match `x` shape.'
5556
n_items = np.prod(x.shape)
5657
zero_indices = np.setdiff1d(np.arange(n_items), x.indices, assume_unique=True)
5758
return weights[zero_indices]

0 commit comments

Comments
 (0)