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] Linear Projection: Fix LDA #5828

Merged
merged 2 commits into from
Feb 11, 2022
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
5 changes: 4 additions & 1 deletion Orange/widgets/visualize/owlinearprojection.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,10 @@ def effective_variables(self):

@property
def effective_data(self):
return self.data.transform(Domain(self.effective_variables))
cvs = None
if self.placement == Placement.LDA:
cvs = self.data.domain.class_vars
return self.data.transform(Domain(self.effective_variables, cvs))

def __vizrank_set_attrs(self, attrs):
if not attrs:
Expand Down
2 changes: 2 additions & 0 deletions Orange/widgets/visualize/tests/test_owlinearprojection.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def test_no_data_for_lda(self):
self.send_signal(self.widget.Inputs.data, self.data)
self.widget.radio_placement.buttons[Placement.LDA].click()
self.assertTrue(buttons[Placement.LDA].isEnabled())
output = self.get_output(self.widget.Outputs.components)
self.assertTrue(output and len(output) == 2)
self.send_signal(self.widget.Inputs.data, Table("housing"))
self.assertFalse(buttons[Placement.LDA].isEnabled())
self.send_signal(self.widget.Inputs.data, None)
Expand Down
5 changes: 4 additions & 1 deletion Orange/widgets/visualize/utils/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,10 @@ def set_data(self, data):
self.openContext(self.data)
self._invalidated = not (
data_existed and self.data is not None and
array_equal(effective_data.X, self.effective_data.X))
array_equal(effective_data.X, self.effective_data.X) and
array_equal(effective_data.Y, self.effective_data.Y) and
array_equal(effective_data.metas, self.effective_data.metas)
)
self._domain_invalidated = not (
data_existed and self.data is not None and
effective_data.domain.checksum()
Expand Down