问题描述
我正在尝试在H2O XGBoost中简单地使用hyperopt,为此我正在从numpy数组中取出元素作为参数,但是我遇到了H2OTypeError,我不明白为什么{{ ?integer
未满足1}}。
为简化示例,H2O XGBoost的调用方式为:
int64
但是以下内容会返回此H2OTypeError:
xgb = H2OXGBoostEstimator(nfolds=5,max_depth=list(range(10,11))[0])
...
xgb = H2OXGBoostEstimator(nfolds=5,max_depth=np.arange(10,11,1)[0])
我现在可以解决该错误,但我不理解。
解决方法
H2O期望使用本机Python int
,但是您正在传递numpy int64
。 here进一步说明了差异。
尝试将numpy数组转换为列表max_depth=np.arange(10,11,1).tolist()[0]