Check existance of seed/nthread keys before checking their value. (#2669)
This commit is contained in:
parent
0eaf43a5e1
commit
5c9f0ff9d9
@ -71,3 +71,4 @@ List of Contributors
|
|||||||
- Rory is the author of the GPU plugin and also contributed the cmake build system and windows continuous integration
|
- Rory is the author of the GPU plugin and also contributed the cmake build system and windows continuous integration
|
||||||
* [Gideon Whitehead](https://github.com/gaw89)
|
* [Gideon Whitehead](https://github.com/gaw89)
|
||||||
* [Yi-Lin Juang](https://github.com/frankyjuang)
|
* [Yi-Lin Juang](https://github.com/frankyjuang)
|
||||||
|
* [Andrew Hannigan](https://github.com/andrewhannigan)
|
||||||
|
|||||||
@ -195,14 +195,14 @@ class XGBModel(XGBModelBase):
|
|||||||
"""Get xgboost type parameters."""
|
"""Get xgboost type parameters."""
|
||||||
xgb_params = self.get_params()
|
xgb_params = self.get_params()
|
||||||
random_state = xgb_params.pop('random_state')
|
random_state = xgb_params.pop('random_state')
|
||||||
if xgb_params['seed'] is not None:
|
if 'seed' in xgb_params and xgb_params['seed'] is not None:
|
||||||
warnings.warn('The seed parameter is deprecated as of version .6.'
|
warnings.warn('The seed parameter is deprecated as of version .6.'
|
||||||
'Please use random_state instead.'
|
'Please use random_state instead.'
|
||||||
'seed is deprecated.', DeprecationWarning)
|
'seed is deprecated.', DeprecationWarning)
|
||||||
else:
|
else:
|
||||||
xgb_params['seed'] = random_state
|
xgb_params['seed'] = random_state
|
||||||
n_jobs = xgb_params.pop('n_jobs')
|
n_jobs = xgb_params.pop('n_jobs')
|
||||||
if xgb_params['nthread'] is not None:
|
if 'nthread' in xgb_params and xgb_params['nthread'] is not None:
|
||||||
warnings.warn('The nthread parameter is deprecated as of version .6.'
|
warnings.warn('The nthread parameter is deprecated as of version .6.'
|
||||||
'Please use n_jobs instead.'
|
'Please use n_jobs instead.'
|
||||||
'nthread is deprecated.', DeprecationWarning)
|
'nthread is deprecated.', DeprecationWarning)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user