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] Model's data_to_model_domain supports sparse matrix #4081

Merged
merged 1 commit into from
Oct 11, 2019

Conversation

PrimozGodec
Copy link
Contributor

Issue

Fixes #3987

Description of changes

Model's data_to_model_domain fixed to accept also sparse data.

Includes
  • Code changes
  • Tests
  • Documentation

@PrimozGodec PrimozGodec force-pushed the fix-predictor branch 2 times, most recently from d1ff14c to 3e157b2 Compare October 7, 2019 09:59
@codecov
Copy link

codecov bot commented Oct 7, 2019

Codecov Report

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

@@            Coverage Diff             @@
##           master    #4081      +/-   ##
==========================================
+ Coverage   85.55%   85.56%   +<.01%     
==========================================
  Files         385      385              
  Lines       69162    69178      +16     
==========================================
+ Hits        59175    59191      +16     
  Misses       9987     9987

Orange/base.py Outdated
@@ -320,9 +321,12 @@ def data_to_model_domain():

if self.original_domain.attributes != data.domain.attributes \
and data.X.size \
and not np.isnan(data.X).all():
and not np.isnan(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is right. You want to check if all the entries are not nan, but then you only check the non-zero entries for sparse matrices. This behaviour is not consistent with what will happen for dense matrices. Also, consider taking a look at potentially useful sparse utilities here and use those where possible. If a use case is missing, such as the one you're introducing right now, please add it there, otherwise, there's a lot of duplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. :) I totally forgot that in sparse matrix unknown values are actually zeroes. Now it is fixed. I implemented that as a function similar to any_nan.

@PrimozGodec PrimozGodec force-pushed the fix-predictor branch 3 times, most recently from 9b0b67b to 44f585a Compare October 8, 2019 18:41
@janezd janezd self-assigned this Oct 11, 2019
@janezd janezd merged commit d36c6aa into biolab:master Oct 11, 2019
@PrimozGodec PrimozGodec deleted the fix-predictor branch October 11, 2019 10:04
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.

OWPredictions: support two sparse inputs.
3 participants