Repository navigation
Export MulticlassLabelDataset from aif360.datasets - #581
Open
siddhantharsh wants to merge 1 commit into
Open
siddhantharsh wants to merge 1 commit into
siddhantharsh wants to merge 1 commit into
Conversation
MulticlassLabelDataset could only be imported from its submodule, unlike every other dataset class, and had no page in the docs. - Import it in aif360/datasets/__init__.py (after BinaryLabelDataset, since the module itself imports StructuredDataset from the package). - List it under "Base classes" in docs/source/modules/datasets.rst. - Remove a stray zero-width space from the validate_dataset docstring that made Sphinx report "Unexpected indentation" once the class was added to the docs. - Add tests/test_multiclass_label_dataset.py. Closes Trusted-AI#425 Signed-off-by: siddhantharsh <siddhant101213@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #425
Problem
MulticlassLabelDatasetcannot be imported fromaif360.datasetsthe way the other dataset classes can:It is only reachable through
aif360.datasets.multiclass_label_dataset, and it has no page in the API docs.Fix
aif360/datasets/__init__.py, afterBinaryLabelDataset. The order matters:multiclass_label_dataset.pydoesfrom aif360.datasets import StructuredDataset, so importing it beforeStructuredDatasetis defined in the package raises a circular import error.docs/source/modules/datasets.rst.validate_datasetdocstring inmulticlass_label_dataset.py. It sat on what should be a blank line, and once the class was added to the docs it made Sphinx report "Unexpected indentation" on the class page. This is a one-line change and the file's CRLF line endings are unchanged.tests/test_multiclass_label_dataset.py.No behaviour changes: this only makes an existing class importable from the package and documents it. No new dependencies or datasets.
Testing
Python 3.12, following CONTRIBUTING.
mainwith theImportErrorabove and pass with this change.pytest tests/test_multiclass_label_dataset.py tests/test_classification_metric.py tests/test_structured_dataset.py: 13 passed.pytest tests: no new failures compared withmain. Every test that fails with this change also fails onmain; in my environment those need R (MEPS, fairadapt) or hit dependency version drift (fmin_l_bfgs_bin the LFR tests, the bank loader).flake8 . --select=E9,F63,F7,F82(the CI hard-fail rules): no errors.make htmlindocs/builds, theMulticlassLabelDatasetpage is generated, and there are no warnings about it.The commit is signed off (DCO).