Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] ROC Analysis: color support for more than 9 evaluation learners #2394

Merged
merged 2 commits into from
Jun 23, 2017
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
6 changes: 4 additions & 2 deletions Orange/widgets/evaluate/owrocanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,10 @@ def _initialize(self, results):
names = ["#{}".format(i + 1)
for i in range(len(results.predicted))]

self.colors = colorpalette.ColorPaletteGenerator(
len(names), colorbrewer.colorSchemes["qualitative"]["Dark2"])
scheme = colorbrewer.colorSchemes["qualitative"]["Dark2"]
if len(names) > len(scheme):
scheme = colorpalette.DefaultRGBColors
self.colors = colorpalette.ColorPaletteGenerator(len(names), scheme)

self.classifier_names = names
self.selected_classifiers = list(range(len(names)))
Expand Down
23 changes: 22 additions & 1 deletion Orange/widgets/evaluate/tests/test_owrocanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,25 @@ def test_nan_input(self):
self.send_signal("Evaluation Results", res)
self.assertTrue(self.widget.Error.invalid_results.is_shown())
self.send_signal("Evaluation Results", None)
self.assertFalse(self.widget.Error.invalid_results.is_shown())
self.assertFalse(self.widget.Error.invalid_results.is_shown())

def test_many_evaluation_results(self):
"""
Now works with more than 9 evaluation results.
GH-2394
"""
data = Orange.data.Table("iris")
learners = [
Orange.classification.MajorityLearner(),
Orange.classification.LogisticRegressionLearner(),
Orange.classification.TreeLearner(),
Orange.classification.SVMLearner(),
Orange.classification.KNNLearner(),
Orange.classification.CN2Learner(),
Orange.classification.SGDClassificationLearner(),
Orange.classification.RandomForestLearner(),
Orange.classification.NaiveBayesLearner(),
Orange.classification.SGDClassificationLearner()
]
res = Orange.evaluation.CrossValidation(data, learners, k=2, store_data=True)
self.send_signal("Evaluation Results", res)