【问题标题】:H2OTypeError: Argument should be an ?integer, got int64 [3.30.1.1]H2OTypeError:参数应该是一个?整数,得到 int64 [3.30.1.1]
【发布时间】:2020-12-16 07:01:11
【问题描述】:

我正在尝试将 hyperopt 与 H2O XGBoost 一起简单地使用,为此我从参数的 numpy 数组中取出元素,但我得到了这个 H2OTypeError 并且我不明白为什么 @987654321 的条件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

我现在可以解决这个错误,但我不明白。

【问题讨论】:

    标签: numpy typeerror xgboost h2o hyperopt


    【解决方案1】:

    H2O 期待原生 Python int,但您传递的是 numpy int64。更多关于差异的解释here

    尝试将numpy数组转换成列表max_depth=np.arange(10,11,1).tolist()[0]

    【讨论】:

      猜你喜欢
      • 2022-10-17
      • 2016-02-09
      • 2022-08-06
      • 1970-01-01
      • 1970-01-01
      • 2023-02-09
      • 1970-01-01
      • 1970-01-01
      • 2019-10-23
      相关资源
      最近更新 更多