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

[ENH] Table.transpose: Use heuristic to guess data type of attributes of attributes #1844

Merged
merged 2 commits into from
Jan 4, 2017

Conversation

VesnaT
Copy link
Contributor

@VesnaT VesnaT commented Dec 29, 2016

Issue

Attributes' data type is StringVariable by default. Use heuristic to guess it.

Description of changes

Refactor io.py to make guessing heuristic reusable.
Use heuristic to guess data type of attributes to be saved to metas.

Includes
  • Code changes
  • Tests
  • Documentation

@codecov-io
Copy link

codecov-io commented Dec 29, 2016

Current coverage is 89.24% (diff: 98.48%)

Merging #1844 into master will increase coverage by 0.04%

@@             master      #1844   diff @@
==========================================
  Files            86         86          
  Lines          9077       9100    +23   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           8096       8121    +25   
+ Misses          981        979     -2   
  Partials          0          0          

Sunburst

Powered by Codecov. Last update 8a6f524...2f13f0f

@ajdapretnar
Copy link
Contributor

This fails with Corpus (sparse issues, @nikicc) and with ImportImages (likely because data only has metas).

@ajdapretnar
Copy link
Contributor

Sorry, not part of this PR. Just random bugs I discovered, should be in a different PR.

@ajdapretnar
Copy link
Contributor

On the topic of this PR: shouldn't this make transposed zoo.tab also discrete? Or at least titanic, since it indeed has mostly 0 and 1 (if that's the criterium)? Dunno....

@@ -1453,6 +1453,8 @@ def transpose(cls, table, feature_names_column="",
feature names are mapped
:return: Table - transposed table
"""
from Orange.data.io import guess_data_type, sanitize_variable
Copy link
Contributor

Choose a reason for hiding this comment

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

This import does not seem particularly slow or special in a way that would warrant local importing inside a function instead of at the top of the file. Or am I missing something?

@@ -2546,7 +2576,7 @@ def _compare_tables(self, table1, table2):
self.assertEqual(table1.n_rows, table2.n_rows)
np.testing.assert_array_equal(table1.X, table2.X)
np.testing.assert_array_equal(table1.Y, table2.Y)
np.testing.assert_array_equal(table1.metas, table2.metas)
self.assertTrue((table1.metas == table1.metas).all())
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess not.

@VesnaT VesnaT force-pushed the transpose_guess_type branch 2 times, most recently from d360800 to 2f13f0f Compare January 3, 2017 15:14
@lanzagar lanzagar changed the title Table (transpose): Use heuristic to guess data type of attributes of attributes [ENH] Table.transpose: Use heuristic to guess data type of attributes of attributes Jan 4, 2017
@lanzagar lanzagar merged commit aa1ab0b into biolab:master Jan 4, 2017
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