Skip to content
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

Doctests are failing for some functions #1092

Open
gogetron opened this issue Apr 10, 2024 · 1 comment
Open

Doctests are failing for some functions #1092

gogetron opened this issue Apr 10, 2024 · 1 comment

Comments

@gogetron
Copy link
Contributor

I have realized after working on #1087 that there are other functions in some files with failing doctests / code examples in the functions documentation. In addition, the idea of running doctests in CI was mentioned in #366. If this is something that might be of interest I would be willing to work on fixing the doctests and then adding this verification as part of the CI. However it will require some work to fix all of the doctests and I wanted to ask first if this is something you are interested in. If so how would you prefer this issue to be handled (1 single PR with multiple commits fixing all doctests, multiple PRs fixing the doctests for each file and then another PR adding doctests to CI, ...)?

One example of this failing test can be found in "cleanlab/datalab/internal/issue_manager/label.py"

...
@staticmethod
    def _process_find_label_issues_kwargs(kwargs: Dict[str, Any]) -> Dict[str, Any]:
        """Searches for keyword arguments that are meant for the
        CleanLearning.find_label_issues method call

        Examples
        --------
        >>> from cleanlab.datalab.internal.issue_manager.label import LabelIssueManager
        >>> LabelIssueManager._process_clean_learning_kwargs(thresholds=[0.1, 0.9])
        {'thresholds': [0.1, 0.9]}
        """
        accepted_kwargs = [
            "thresholds",
            "noise_matrix",
            "inverse_noise_matrix",
            "save_space",
            "clf_kwargs",
            "validation_func",
        ]
        return {k: v for k, v in kwargs.items() if k in accepted_kwargs and v is not None}

There a a few issues with the example code in the docs. First of all _process_clean_learning_kwargs does not exist for LabelIssueManager. In addition, thresholds is not a parameter for this function, we need to add ** before the kwargs parameter in the function definition to make that behavior possible.

@desboisGIT
Copy link
Contributor

ok il do. i would like to update the docs like that:

>>> from cleanlab.datalab.internal.issue_manager.label import LabelIssueManager
>>> LabelIssueManager._process_find_label_issues_kwargs(thresholds=[0.1, 0.9])
{'thresholds': [0.1, 0.9]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants