简体   繁体   中英

H2OTypeError: Argument should be an ?integer, got int64 [3.30.1.1]

I'm trying a simple use of hyperopt with H2O XGBoost for which I'm taking elements out of a numpy array for the parameters, but I'm getting this H2OTypeError and I don't understand why the condition of ?integer isn't met by int64 .

To simplify the example, H2O XGBoost does work when called as:

xgb = H2OXGBoostEstimator(nfolds=5, max_depth=list(range(10,11))[0])

But the following returns this H2OTypeError:

xgb = H2OXGBoostEstimator(nfolds=5, max_depth=np.arange(10,11,1)[0])

...

H2OTypeError: Argument `max_depth` should be an ?integer, got int64

I can work around the error for now, but I don't understand it.

H2O is expecting a native Python int , but you are passing a numpy int64 . More is explained here about the differences.

Try converting the numpy array into a list max_depth=np.arange(10,11,1).tolist()[0]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM