我遇到了一个奇怪的问题:我通过 hyperopt
定义了我的 XGB 超参数'max_depth'
hp.choice('max_depth',range(2,20))
Run Code Online (Sandbox Code Playgroud)
但我得到'max_depth' = 0或1结果,这不在[2,20)限制之内。为什么?我错过了什么吗?谢谢。
错误结果:
{'colsample_bytree': 0.18, 'learning_rate': 0.05, 'max_depth': 1, 'reg_alpha': 3.44, 'reg_lambda': 0.92}
{'colsample_bytree': 0.41, 'learning_rate': 0.09, 'max_depth': 0, 'reg_alpha': 0.14, 'reg_lambda': 3.53}
{'colsample_bytree': 0.71, 'learning_rate': 0.17, 'max_depth': 0, 'reg_alpha': 2.21, 'reg_lambda': 2.82}
Run Code Online (Sandbox Code Playgroud)
hp.choice('max_depth',range(2,20))
Run Code Online (Sandbox Code Playgroud)