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] OWDistances: Mahalanobis wrong dimensions notification. #1762

Merged
merged 2 commits into from
Nov 18, 2016

Conversation

acopar
Copy link
Contributor

@acopar acopar commented Nov 18, 2016

Issue

ValueError: 'Too few observations for the number of dimensions.'

Workflow:

  1. Paint data (paint & send) -> Distance.
  2. Select columns and Mahalanobis metric.
Description of changes

Adds shape check and error notification.

Includes
  • Code changes
  • Tests
  • Documentation

owdistances.py: error notification when there is too few observations for Mahalanobis distance. Prevents ValueError exception from distance/init.py class MahalanobisDistance.

owdistances.py: error notification when there is too few observations for Mahalanobis distance. Prevents ValueError exception from distance/__init__.py class MahalanobisDistance.
@CLAassistant
Copy link

CLAassistant commented Nov 18, 2016

CLA assistant check
All committers have signed the CLA.

@astaric
Copy link
Member

astaric commented Nov 18, 2016

Could you try to write a simple tests which sends the wrong kind of data to distance widget and check that a warning is displayed instead of crashing?

@codecov-io
Copy link

codecov-io commented Nov 18, 2016

Current coverage is 88.91% (diff: 100%)

Merging #1762 into master will not change coverage

@@             master      #1762   diff @@
==========================================
  Files            82         82          
  Lines          8847       8847          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           7866       7866          
  Misses          981        981          
  Partials          0          0          

Sunburst

Powered by Codecov. Last update 92bba3f...d257f5c

unsupervised/tests/test_owdistances.py:
- tests that compute_distances does not return ValueError
- checks if error message is displayed
self.widget.axis = 1
self.send_signal("Data", self.iris)
self.widget.compute_distances(Mahalanobis, self.iris)
self.assertTrue(self.widget.Error.too_few_observations.is_shown())
Copy link
Member

Choose a reason for hiding this comment

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

Can you please configure PyCharm to always include new line on the last line of file?

http://stackoverflow.com/questions/36043061/automatically-add-newline-on-save-in-pycharm

@astaric astaric merged commit b896110 into biolab:master Nov 18, 2016
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