-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Describe the bug
Fails to parse type of optional num_iteration parameter for LightGBM's predict method
INFO:[2024-10-24 10:47:23.863] - Analyzing arguments in <bound method Booster.predict of <lightgbm.basic.Booster object at 0x106d97230>>.
WARNING:[2024-10-24 10:47:23.863] - For model predict argument writes not supported type typing.Union[str, pathlib._local.Path, numpy.ndarray, pandas.core.frame.DataFrame, lightgbm.compat.dt_DataTable, scipy.sparse._matrix.spmatrix, lightgbm.compat.pa_Table]. Skip added validation
WARNING:[2024-10-24 10:47:23.863] - For model predict argument writes not supported type typing.Optional[int]. Skip added validation
WARNING:[2024-10-24 10:47:23.863] - Found unpacked argument: FullArgSpec(args=['self', 'data', 'start_iteration', 'num_iteration', 'raw_score', 'pred_leaf', 'pred_contrib', 'data_has_header', 'validate_features'], varargs=None, varkw='kwargs', defaults=(0, None, False, False, False, False, False), kwonlyargs=[], kwonlydefaults=None, annotations={'return': typing.Union[numpy.ndarray, scipy.sparse._matrix.spmatrix, typing.List[scipy.sparse._matrix.spmatrix]], 'data': typing.Union[str, pathlib._local.Path, numpy.ndarray, pandas.core.frame.DataFrame, lightgbm.compat.dt_DataTable, scipy.sparse._matrix.spmatrix, lightgbm.compat.pa_Table], 'start_iteration': <class 'int'>, 'num_iteration': typing.Optional[int], 'raw_score': <class 'bool'>, 'pred_leaf': <class 'bool'>, 'pred_contrib': <class 'bool'>, 'data_has_header': <class 'bool'>, 'validate_features': <class 'bool'>, 'kwargs': typing.Any}). Skip argument
INFO:[2024-10-24 10:47:23.863] - X argument in predict method not found. For predict data use first argument with name "data".
INFO:[2024-10-24 10:47:23.863] - Time to load model settings: 0.001.
INFO:[2024-10-24 10:47:23.863] - Run load Web application
WARNING:[2024-10-24 10:47:23.864] - Field "num_iteration" has not a type. Please write type for field. Supported types int, float, bool, str, list.
To Reproduce
Steps to reproduce the behavior:
- Modify
example-config.yamlto load examplelightgbm-binary_cls_model.pckl - Run
from_config.py - See warning
- Open API documentation and see that
num_iterationhas a default value of "string"
Expected behavior
It should detect that num_iteration is type int but optional. Being optional, the example request in the API docs should not include num_iteration and should correctly indicate that it is an optional int.
Environment (please complete the following information):
- Python version 3.12.7
- Version PyMLup 0.2.2
- LightGBM 4.5.0
nxexox
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers