Skip to content

Commit

Permalink
Improve the flow of several learning widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Dec 3, 2021
1 parent a08cf60 commit 6176b2c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions Orange/widgets/model/owadaboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ def set_base_learner(self, learner):
self.base_estimator = learner or self.DEFAULT_BASE_ESTIMATOR
self.base_label.setText(
"Base estimator: %s" % self.base_estimator.name.title())
if self.auto_apply:
self.apply()
self.learner = self.model = None

def get_learner_parameters(self):
return (("Base estimator", self.base_estimator),
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/model/owcalibratedlearner.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def add_main_layout(self):
def set_learner(self, learner):
self.base_learner = learner
self._set_default_name()
self.unconditional_apply()
self.learner = self.model = None

def _set_default_name(self):

Expand Down
3 changes: 0 additions & 3 deletions Orange/widgets/model/owlinearregression.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ def add_main_layout(self):
self.controls.alpha_index.setEnabled(self.reg_type != self.OLS)
self.l2_ratio_slider.setEnabled(self.reg_type == self.Elastic)

def handleNewSignals(self):
self.apply()

def _intercept_changed(self):
self.apply()

Expand Down
10 changes: 7 additions & 3 deletions Orange/widgets/model/owstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,26 @@ def add_main_layout(self):
@Inputs.learners
def set_learner(self, index: int, learner: Learner):
self.learners[index] = learner
self.invalidate()

@Inputs.learners.insert
def insert_learner(self, index, learner):
self.learners.insert(index, learner)
self.invalidate()

@Inputs.learners.remove
def remove_learner(self, index):
self.learners.pop(index)
self.invalidate()

@Inputs.aggregate
def set_aggregate(self, aggregate):
self.aggregate = aggregate
self.invalidate()

def handleNewSignals(self):
super().handleNewSignals()
self.apply()
def _invalidate(self):
self.learner = self.model = None
# ... and handleNewSignals will do the rest

def create_learner(self):
if not self.learners:
Expand Down

0 comments on commit 6176b2c

Please sign in to comment.