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] Scatter Plot: VizRank disabled when no class vars #2757

Merged
merged 1 commit into from
Nov 10, 2017
Merged

[FIX] Scatter Plot: VizRank disabled when no class vars #2757

merged 1 commit into from
Nov 10, 2017

Conversation

jerneju
Copy link
Contributor

@jerneju jerneju commented Nov 9, 2017

Issue

Scatter Plot VizRank crashes when class column has only nan values.

Description of changes

VizRank is disabled as it is when there is no class_var.

Includes
  • Code changes
  • Tests
  • Documentation

@jerneju
Copy link
Contributor Author

jerneju commented Nov 9, 2017

@codecov-io
Copy link

codecov-io commented Nov 9, 2017

Codecov Report

Merging #2757 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2757      +/-   ##
==========================================
+ Coverage   76.05%   76.06%   +<.01%     
==========================================
  Files         338      338              
  Lines       59670    59683      +13     
==========================================
+ Hits        45380    45395      +15     
+ Misses      14290    14288       -2

@jerneju jerneju added this to the 3.8 milestone Nov 10, 2017
domain = Domain(
attributes=data2.domain.attributes[:4], class_vars=DiscreteVariable("iris", values=[]))
data2 = Table(domain, data2.X, Y=data2.Y)
data3 = Table("iris")[::30]
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the difference between data1 and data3? (i.e. why this line)

Copy link
Contributor Author

@jerneju jerneju Nov 10, 2017

Choose a reason for hiding this comment

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

Now there is the difference.

@@ -252,6 +252,8 @@ def set_data(self, data):
self.vizrank_button.setEnabled(
self.data is not None and not self.data.is_sparse() and
self.data.domain.class_var is not None and
(len(self.data.domain.class_var.values)
if self.data.domain.class_var.is_discrete else True) and
Copy link
Contributor

Choose a reason for hiding this comment

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

This fixes the case when the class has no values. How about when the class has e.g. 3 values, but all instances have unknown classes (e.g. a test set with the same variable as the training set, but class unknown)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Updated.

@lanzagar lanzagar merged commit 7b86408 into biolab:master Nov 10, 2017
@jerneju jerneju deleted the scatterplot-vizrank-classvar-nan branch November 10, 2017 14:48
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.

3 participants