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

[python-package] fix mypy errors related to eval result tuples #6097

Merged
merged 6 commits into from
Sep 13, 2023

Conversation

jameslamb
Copy link
Collaborator

@jameslamb jameslamb commented Sep 13, 2023

Contributes to #3756.
Contributes to #3867.

Resolves the following errors from mypy:

engine.py:533: error: List comprehension has incompatible type List[Tuple[str, str, floating[Any], bool, floating[Any]]]; expected List[Tuple[str, str, float, bool, float]]  [misc]
engine.py:773: error: Argument "evaluation_result_list" to "CallbackEnv" has incompatible type "List[Tuple[str, str, float, bool, float]]"; expected "Optional[List[Tuple[str, str, float, bool]]]"  [arg-type]

These both came from an incorrect type hint on lightgbm.callback.CallbackEnv.evaluation_result_list, which failed to include the possibility of eval result tuples that included a 5th element for the across-folds standard deviation of metrics, as are calculated in cv().

@jameslamb jameslamb changed the title WIP: [python-package] fix mypy errors related to eval result tuples [python-package] fix mypy errors related to eval result tuples Sep 13, 2023
@jameslamb
Copy link
Collaborator Author

jameslamb commented Sep 13, 2023

cc @raubitsj @ayulockin I noticed tonight that this issue with the type hints was noticed almost 2 years ago in your development on wandb:

First... thanks for your work on that integration, in helping LightGBM's users get the most of their models.

In the future, we'd really appreciate contributions here when you notice issues in LightGBM. Both code contributions and documenting problems at https://github.com/microsoft/LightGBM/issues are very helpful to the project. I'd be happy to help answer any questions you have about contributing, or to hear any critical feedback you have about ways we could improve the contribution process.

@jameslamb jameslamb marked this pull request as ready for review September 13, 2023 05:03
@ayulockin
Copy link

Thanks for pointing out @jameslamb. It might have slipped out while rapidly developing the integration. Will make sure to open an issue if we spot any.

@jameslamb jameslamb merged commit 1a6e6ff into master Sep 13, 2023
41 checks passed
@jameslamb jameslamb deleted the python/eval-tuples-types branch September 13, 2023 16:43
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants