Skip to content

Commit

Permalink
scoring sheets, adapt test for randomness
Browse files Browse the repository at this point in the history
  • Loading branch information
markotoplak committed Oct 25, 2024
1 parent b4e6be2 commit c227ee4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Orange/classification/utils/fasterrisk/fasterrisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def __init__(self, X, y, k, select_top_m=50, lb=-5, ub=5, \
else:
assert type(group_sparsity) == int, "group_sparsity needs to be an integer"
assert group_sparsity > 0, "group_sparsity needs to be > 0!"
assert group_sparsity > 0, "group_sparsity needs to be > 0!"

assert self.featureIndex_to_groupIndex is not None, "featureIndex_to_groupIndex must be provided if group_sparsity is not None"
assert type(self.featureIndex_to_groupIndex[0]) == np.int_, "featureIndex_to_groupIndex needs to be a NumPy integer array"
Expand Down
5 changes: 4 additions & 1 deletion Orange/widgets/model/tests/test_owscoringsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ def test_settings_in_model(self):
non_zero_coefficients = [coef for coef in coefficients if coef != 0]

self.assertEqual(len(coefficients), self.widget.num_attr_after_selection)
self.assertEqual(len(non_zero_coefficients), self.widget.num_decision_params)

# most often equal, but in some cases the optimizer finds fewer parameters
self.assertLessEqual(len(non_zero_coefficients), self.widget.num_decision_params)

self.assertLessEqual(
max(non_zero_coefficients, key=lambda x: abs(x)),
self.widget.max_points_per_param,
Expand Down

0 comments on commit c227ee4

Please sign in to comment.