-
-
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
[ENH] MDS: Show Kruskal stress #6309
Conversation
ff64af7
to
fed44cb
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #6309 +/- ##
=======================================
Coverage 87.47% 87.48%
=======================================
Files 316 316
Lines 68085 68115 +30
=======================================
+ Hits 59556 59589 +33
+ Misses 8529 8526 -3 |
fed44cb
to
cbfedc3
Compare
@@ -200,6 +200,7 @@ def __init__(self): | |||
|
|||
self.embedding = None # type: Optional[np.ndarray] | |||
self.effective_matrix = None # type: Optional[DistMatrix] | |||
self.stress = None |
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.
As shown by failing tests, this conflicts with the static method with the same name.
This results in a crash when setting the size of points to "Stress".
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.
It's not that I don't warn students about this exact mistake.
cbfedc3
to
56eff89
Compare
56eff89
to
2e01854
Compare
Orange/widgets/unsupervised/owmds.py
Outdated
def _compute_stress(self): | ||
if self.embedding is None or self.effective_matrix is None: | ||
return None | ||
actual = scipy.spatial.distance.pdist(self.embedding) | ||
actual = scipy.spatial.distance.squareform(actual) | ||
return np.sqrt(np.sum((actual - self.effective_matrix) ** 2) | ||
/ (np.sum(self.effective_matrix ** 2) or 1)) |
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.
It would probably be better to call get_stress
and normalize the returned result.
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.
Done.
2e01854
to
0d145ab
Compare
Issue
Fixes #6070.
Description of changes
To reviewer: please check that I indeed called
update_stress
from all places where it's needed -- and that it's not called multiple times.I don't know where to show the stress. Optimization box was about the best place. I don't want to put it on the graph, because then we'd need to at least allow the user to move it and ... no.
Includes