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] Improve ada boost widget #1787

Merged
merged 1 commit into from
Dec 2, 2016

Conversation

pavlin-policar
Copy link
Collaborator

@pavlin-policar pavlin-policar commented Nov 30, 2016

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
  • Code changes
  • Tests
  • Documentation

@codecov-io
Copy link

codecov-io commented Nov 30, 2016

Current coverage is 88.96% (diff: 100%)

Merging #1787 into master will not change coverage

@@             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          

Sunburst

Powered by Codecov. Last update e069705...fa6c972

@pavlin-policar pavlin-policar changed the title Improve ada boost widget [FIX] Improve ada boost widget Nov 30, 2016
@astaric astaric added this to the 3.3.9 milestone Nov 30, 2016
self.base_estimator = self.DEFAULT_BASE_ESTIMATOR
else:
self.base_estimator = learner or self.DEFAULT_BASE_ESTIMATOR
self.base_label.setText(
Copy link
Contributor

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.

Copy link
Collaborator Author

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the widget still works, but uses the default learner instead of the one provided, maybe a Warning is more appropriate than Error (which usually indicates that you can't continue working).
@astaric @janezd ?

Copy link
Contributor

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.
@lanzagar lanzagar merged commit 11c3f11 into biolab:master Dec 2, 2016
@pavlin-policar pavlin-policar deleted the improve-ada-boost-widget branch December 2, 2016 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants