Skip to content

[FIX] OWDataProjectionWidget: check validity, fix sparse data reloading#3485

Merged
markotoplak merged 4 commits intobiolab:masterfrom
VesnaT:fix_widget_1
Jan 4, 2019
Merged

[FIX] OWDataProjectionWidget: check validity, fix sparse data reloading#3485
markotoplak merged 4 commits intobiolab:masterfrom
VesnaT:fix_widget_1

Conversation

@VesnaT
Copy link
Contributor

@VesnaT VesnaT commented Dec 18, 2018

Issue
  1. Fixes ValueError: zero-size array to reduction operation minimum which has no identity #3484
  2. The widget crashes when reloading sparse data, because sparse matrices equality can not be checked with numpy
Description of changes
  1. return no coordinates when no valid data (return None instead of an empty array)
  2. fix reloading sparse data
Includes
  • Code changes
  • Tests
  • Documentation

@VesnaT VesnaT changed the title OWDataProjectionWidget: Return no coordinates when no valid data [FIX] OWDataProjectionWidget: Return no coordinates when no valid data Dec 20, 2018
@VesnaT VesnaT changed the title [FIX] OWDataProjectionWidget: Return no coordinates when no valid data [WIP][FIX] OWDataProjectionWidget: Return no coordinates when no valid data Dec 20, 2018
@codecov
Copy link

codecov bot commented Dec 20, 2018

Codecov Report

Merging #3485 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #3485      +/-   ##
==========================================
+ Coverage   83.55%   83.57%   +0.02%     
==========================================
  Files         367      367              
  Lines       65454    65470      +16     
==========================================
+ Hits        54691    54718      +27     
+ Misses      10763    10752      -11

@codecov
Copy link

codecov bot commented Dec 20, 2018

Codecov Report

Merging #3485 into master will increase coverage by 0.03%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #3485      +/-   ##
==========================================
+ Coverage   83.55%   83.59%   +0.03%     
==========================================
  Files         368      368              
  Lines       65772    65807      +35     
==========================================
+ Hits        54956    55009      +53     
+ Misses      10816    10798      -18

@VesnaT VesnaT changed the title [WIP][FIX] OWDataProjectionWidget: Return no coordinates when no valid data [FIX] OWDataProjectionWidget: Fixups Dec 20, 2018
@VesnaT VesnaT force-pushed the fix_widget_1 branch 2 times, most recently from 2c86913 to 53dcc22 Compare December 21, 2018 10:20
v2.sort(axis=0)
return np.allclose(v1, v2, equal_nan=True)


Copy link
Contributor

Choose a reason for hiding this comment

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

@VesnaT, if you agree with this, I agree with the rest (which I do anyway) and one of us can merge this.

@janezd janezd requested a review from markotoplak January 4, 2019 08:23
@markotoplak markotoplak self-assigned this Jan 4, 2019

v1 = np.vstack(sp.find(a1)).T
v2 = np.vstack(sp.find(a2)).T
if not (sp.issparse(a1) and sp.issparse(a2)): # Any dense: order indices
Copy link
Member

Choose a reason for hiding this comment

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

So, sp.find internally sorts if the matrices have has_canonical_format=False, which is False when converting from any sparse matrix. Therefore, sparse matrices currently do not have to be resorted, so your optimization works well. Should we rely on such undocumented behavior, @janezd?

@markotoplak markotoplak changed the title [FIX] OWDataProjectionWidget: Fixups [FIX] OWDataProjectionWidget: check validity, fix sparse data reloading Jan 4, 2019
@markotoplak markotoplak merged commit 4a7ecc8 into biolab:master Jan 4, 2019
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.

ValueError: zero-size array to reduction operation minimum which has no identity

4 participants