-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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] Improve ada boost widget #1787
[FIX] Improve ada boost widget #1787
Conversation
d9ad597
to
b7ed9e8
Compare
Current coverage is 88.96% (diff: 100%)@@ master #1787 diff @@
==========================================
Files 82 82
Lines 8963 8963
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 7974 7974
Misses 989 989
Partials 0 0
|
self.base_estimator = self.DEFAULT_BASE_ESTIMATOR | ||
else: | ||
self.base_estimator = learner or self.DEFAULT_BASE_ESTIMATOR | ||
self.base_label.setText( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be outside of the else block (remove one indent).
It sets the base_estimator correctly now, but not the label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I missed that.
from Orange.classification import SklTreeLearner, KNNLearner | ||
from Orange.classification import KNNLearner | ||
from Orange.classification import RandomForestLearner | ||
from Orange.classification import SklTreeLearner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grouping is preferred for imports like these (same as 2 lines below).
@@ -1,5 +1,6 @@ | |||
# Test methods with long descriptive names can omit docstrings | |||
# pylint: disable=missing-docstring | |||
from Orange.regression import RandomForestRegressionLearner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Group imports.
self.assertTrue(self.widget.Error.no_weight_support.is_shown()) | ||
|
||
def test_error_message_cleared_when_valid_learner_on_input(self): | ||
# Disconneting an invalid learner should use the default one and hide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disconnecting
self.assertTrue(self.widget.Error.no_weight_support.is_shown()) | ||
|
||
def test_error_message_cleared_when_valid_learner_on_input(self): | ||
# Disconneting an invalid learner should use the default one and hide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disconnecting
@@ -28,6 +29,11 @@ class OWAdaBoostClassification(OWBaseLearner): | |||
|
|||
DEFAULT_BASE_ESTIMATOR = SklTreeLearner() | |||
|
|||
class Error(OWBaseLearner.Error): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided it is best to have an Error message and require the user removes the invalid input before continuing.
The widget simply crashed if an invalid learner was set as its base estimator. Now, we use the widget Error messages and fail gracefully.
a28e3c3
to
fa6c972
Compare
Issue
AdaBoost simply crashed when a learner without support for
sample_weights
was put onto the input.Description of changes
This does not happen any more, but it uses the Orange widget Error that tells us that the learner doesn't support sample weights. I've also changed the control widths to match most of the other learner widgets.
Includes