Skip to content

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

Merged
lanzagar merged 2 commits intobiolab:masterfrom
VesnaT:transpose_guess_type
Jan 4, 2017
Merged

[ENH] Table.transpose: Use heuristic to guess data type of attributes of attributes#1844
lanzagar merged 2 commits intobiolab:masterfrom
VesnaT:transpose_guess_type

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....

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?

@VesnaT VesnaT force-pushed the transpose_guess_type branch from 33ee7fa to 1a4ac2d Compare January 3, 2017 13:49
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
@VesnaT VesnaT force-pushed the transpose_guess_type branch from 2f13f0f to ff2cdaa Compare January 3, 2017 16:19
@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