Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Orange/classification/majority.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def fit_storage(self, dat):
probs = np.array(dist)
ties = np.flatnonzero(probs == probs.max())
if len(ties) > 1:
random_idx = int(sha1(bytes(dat.Y)).hexdigest(), 16) % len(ties)
random_idx = int(sha1(np.ascontiguousarray(dat.Y).data)
.hexdigest(), 16) % len(ties)
unif_maj = ties[random_idx]
else:
unif_maj = None
Expand Down
3 changes: 2 additions & 1 deletion Orange/classification/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def hash_dist(x):
hash : int
Hash function result.
"""
return int(sha1(bytes(x)).hexdigest(), base=16) & 0xffffffff
return int(sha1(np.ascontiguousarray(x).data)
.hexdigest(), base=16) & 0xffffffff


class Evaluator:
Expand Down
6 changes: 5 additions & 1 deletion Orange/tests/test_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def test_refuse_data_in_constructor(self):
self.assertTrue(os.environ.get('ORANGE_DEPRECATIONS_ERROR'))
expected = self.assertRaises if is_CI else self.assertWarns
with expected(OrangeDeprecationWarning):
Orange.preprocess.preprocess.Preprocess(Table('iris'))
try:
Orange.preprocess.preprocess.Preprocess(Table('iris'))
except NotImplementedError:
# Expected from default Preprocess.__call__
pass


class RemoveConstant(unittest.TestCase):
Expand Down