Unverified Commit 78f95e41 authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[python-package] add more type hints on Booster (#5432)

parent 865c126a
...@@ -2760,7 +2760,7 @@ class Booster: ...@@ -2760,7 +2760,7 @@ class Booster:
booster = Booster(model_str=model_str) booster = Booster(model_str=model_str)
return booster return booster
def __getstate__(self): def __getstate__(self) -> Dict[str, Any]:
this = self.__dict__.copy() this = self.__dict__.copy()
handle = this['handle'] handle = this['handle']
this.pop('train_set', None) this.pop('train_set', None)
...@@ -2769,7 +2769,7 @@ class Booster: ...@@ -2769,7 +2769,7 @@ class Booster:
this["handle"] = self.model_to_string(num_iteration=-1) this["handle"] = self.model_to_string(num_iteration=-1)
return this return this
def __setstate__(self, state): def __setstate__(self, state: Dict[str, Any]) -> None:
model_str = state.get('handle', None) model_str = state.get('handle', None)
if model_str is not None: if model_str is not None:
handle = ctypes.c_void_p() handle = ctypes.c_void_p()
...@@ -3663,16 +3663,16 @@ class Booster: ...@@ -3663,16 +3663,16 @@ class Booster:
self, self,
data, data,
label, label,
decay_rate=0.9, decay_rate: float = 0.9,
reference=None, reference: Optional[Dataset] = None,
weight=None, weight=None,
group=None, group=None,
init_score=None, init_score=None,
feature_name='auto', feature_name: Union[str, List[str]] = 'auto',
categorical_feature='auto', categorical_feature: Union[str, List[str], List[int]] = 'auto',
dataset_params=None, dataset_params: Optional[Dict[str, Any]] = None,
free_raw_data=True, free_raw_data: bool = True,
validate_features=False, validate_features: bool = False,
**kwargs **kwargs
): ):
"""Refit the existing Booster by new data. """Refit the existing Booster by new data.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment