Skip to content

[Test] Auto category conversion test cases - #1771

Open
AtharvaManale wants to merge 3 commits into
openml:mainfrom
AtharvaManale:auto_convert_categories_and_tests
Open

AtharvaManale wants to merge 3 commits into
openml:mainfrom
AtharvaManale:auto_convert_categories_and_tests

Conversation

@AtharvaManale

Copy link
Copy Markdown

Issue reference:

closes/realtes to: #1489

Related pr: #1490

Task performed:

Tested proposed solution in pr #1490 using a couple of edge cases and added tests for integer categories and categorical columns containing missing values.

Observation:

test_case_2) categorical columns containing missing values.(https://github.com/AtharvaManale/openml-python/blob/19f09407bb23712c479cfec988e97d3ae1643d49/tests/test_datasets/test_dataset_functions.py#L681)
result:

FAILED tests/test_datasets/test_dataset_functions.py::TestOpenMLDataset::test_attributes_arff_from_df_missing_values - AssertionError: assert [('category', ['1.0','2.0'])] == [('category', ['1', '2'])]

The integer-category test passes, but the missing-value test produces "1.0" and "2.0" because pandas infers floating-point values from [1, None, 2] before the column is converted to categorical. This raises a broader question about how aggressively the function should normalize category labels and which edge cases it should support.

Automatic conversion may require additional decisions about type normalization and edge cases. Retaining the existing ValueError behavior could be preferable if the project intends to reject unsupported categorical types rather than introduce implicit conversion rules.

No need of merging, just for showcasing the testcases used.

This branch has not been deployed

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

1 participant