TEST Add sparse dataset inclusion coverage for row ID and ignore attributes.
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start in tests/test_datasets/test_dataset.py at OpenMLDatasetTestSparse::test_get_sparse_dataset_rowid_and_ignore_and_target. Run the targeted pytest command from the issue, then inspect the existing exclusion checks and the requested inclusion behavior. Done means the test covers both modes and verifies the returned shape, categorical indicators, and target shape.
Written by the indexing model from the issue text.
Description
Description :-
This PR improves the regression test coverage for sparse dataset retrieval when row ID and ignored attributes are configured for the dataset.
The existing test already defined a row ID attribute and an ignored attribute, but the retrieval operation was performed with both inclusion options disabled. As a result, the test confirmed that these attributes were excluded from the returned feature data, but it did not verify what happens when a caller explicitly requests them.
This change extends the test so that the inclusion behaviour is also checked. The dataset is retrieved with both include_row_id=True and include_ignore_attribute=True, allowing the test to verify that the additional attributes are correctly represented in the returned feature matrix.
The new assertions also check the dimensions of the returned data and the associated categorical information. This ensures that the test does not only execute successfully, but also confirms that the returned dataset has the expected structure.
Changes :-
-
Extended the existing sparse dataset test to cover the case where row ID attributes are explicitly included in the returned features.
-
Added coverage for retrieving attributes that were previously marked as ignored by using include_ignore_attribute=True
-
Verified that enabling both inclusion options results in a feature matrix with the expected shape (600, 20000)
-
Added a check for the length of the categorical indicator list to ensure it corresponds to all 20,000 returned features.
-
Verified that every categorical indicator is False, matching the expected characteristics of the returned sparse dataset.
-
Added an assertion for the target data to confirm that the returned target has the expected shape (600,)
-
Kept the existing exclusion behaviour covered so that the test continues to validate both inclusion and exclusion scenarios.
Testing
The updated sparse dataset test was executed using the following command:
bash
pytest tests/test_datasets/test_dataset.py::OpenMLDatasetTestSparse::test_get_sparse_dataset_rowid_and_ignore_and_target
- Dominant language
- Python
- Stars
- 361
- Forks
- 296
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openml/openml-python
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
openml/openml-python#1746 ·
-
Documentation Good First Issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
openml/openml-python#1708 · 6 comments ·
-
Good First Issue module:Run testing
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
openml/openml-python#1646 · 7 comments · 2 reactions ·
-
Good First Issue module:Data testing
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
openml/openml-python#1644 · 4 comments ·
-
Documentation
openml/openml-python#1744 · 1 comment · 1 assignee ·
All issues in openml/openml-python
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sipyourdrink-ltd/bernstein#6191 ·
-
security severity:low track:open-source
Difficulty 2/5 1-3 hours Newbie friendliness 78/100