-
-
Notifications
You must be signed in to change notification settings - Fork 270
Fixing fetching of categorical sparse data #823
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| import openml | ||
| from openml.testing import TestBase | ||
| from openml.exceptions import PyOpenMLError | ||
| from openml.datasets import OpenMLDataset, OpenMLDataFeature | ||
|
|
||
|
|
||
| class OpenMLDatasetTest(TestBase): | ||
|
|
@@ -320,6 +321,16 @@ def test_get_sparse_dataset_rowid_and_ignore_and_target(self): | |
| self.assertListEqual(categorical, [False] * 19998) | ||
| self.assertEqual(y.shape, (600, )) | ||
|
|
||
| def test_get_sparse_categorical_data_id_395(self): | ||
|
mfeurer marked this conversation as resolved.
|
||
| dataset = openml.datasets.get_dataset(395, download_data=True) | ||
| feature = dataset.features[3758] | ||
| self.assertTrue(isinstance(dataset, OpenMLDataset)) | ||
| self.assertTrue(isinstance(feature, OpenMLDataFeature)) | ||
| self.assertEqual(dataset.name, 're1.wc') | ||
| self.assertEqual(feature.name, 'CLASS_LABEL') | ||
| self.assertEqual(feature.data_type, 'nominal') | ||
| self.assertEqual(len(feature.nominal_values), 25) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add a check for the type of the output value?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for not being clear enough here. Could you please load X and y and check their type, dtype and shape?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, I'm refraining from changing this test now. Have created an issue to take care of such checks independently. |
||
|
|
||
|
|
||
| class OpenMLDatasetQualityTest(TestBase): | ||
| def test__check_qualities(self): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't you mention in person that you need to assign the value of this function call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but with further testing realized that assignment doesn't make sense here since this loop iterates over the attributes. Whereas, if anything needs to be checked, we should check the data. Which is not seemingly throwing any issue.
I checked this chunk of code with both a Sparse_Arff and Arff data formats, the type_ receives exactly the same type and structure of the output. I don't know why the attribute list is being checked for type whereas the
arff.ArffDecoder.decode()seems to return the target feature as a list of the classes. Don't know why a sparse format requires numeric encoding of that attribute list.Hence, I replaced the numpy check with the pandas categorical encoding.