numpy - H2OTypeError:参数应该是一个?整数,得到 int64 [3.30.1.1]
问题描述
我正在尝试将 hyperopt 与 H2O XGBoost 一起简单地使用,为此我从参数的 numpy 数组中取出元素,但是我得到了这个 H2OTypeError 并且我不明白为什么?integer
不满足条件int64
.
为简化示例,H2O XGBoost 在调用时确实有效:
xgb = H2OXGBoostEstimator(nfolds=5, max_depth=list(range(10,11))[0])
但以下返回此 H2OTypeError:
xgb = H2OXGBoostEstimator(nfolds=5, max_depth=np.arange(10,11,1)[0])
...
H2OTypeError: Argument `max_depth` should be an ?integer, got int64
我现在可以解决该错误,但我不明白。
解决方案
H2O 期待原生 Python int
,但您传递的是numpy int64
. 更多关于差异的解释here 。
尝试将 numpy 数组转换为列表max_depth=np.arange(10,11,1).tolist()[0]
推荐阅读
- wordpress - Wordpress CPT UI 和 ACF 自定义字段
- php - GET 的 FOSRestBundle 注释
- ios - 如何将 tableview 单元格保存到 UserDefaults 然后显示它
- c# - 如何最好地处理 C# 中的位数据?
- css - 网格显示列的宽度不相等
- android - 如何抑制 Gradle 自动将 vectorDrawable 转换为 PNG?
- c++ - C++ 如何从 ifstream 和 getline() 中获取子字符串
- css - 在 CSS ::selection 中保持继承背景
- c# - 使用应用程序池标识在 IIS 上的 ASP.NET 中查询 Win32_Printer 时权限被拒绝
- html - 将框重新对齐为 2x3