Skip to content

Error when seed exceeds 32-bit integer max #5637

@pplonski

Description

@pplonski

I'm using Xgboost in my AutoML package. I'm currently adding my package to automlbenchmark When running the benchmark test I got very strange error about seed value. The error is below. The minimal code example to reproduce the error is below. When I'm using smaller seed values every thing works as expected.

import xgboost # 1.0.2 version
import numpy as np

X = np.random.rand(100,4)
y = np.random.randint(0,2,100)
train = xgboost.DMatrix(X, label=y)
model = xgboost.train({"seed": 3657279955}, train)

Error message:

---------------------------------------------------------------------------
XGBoostError                              Traceback (most recent call last)
<ipython-input-135-653bcbdd849c> in <module>
----> 1 model = xgboost.train({"seed": 3657279955}, train)

~/Downloads/numerai_datasets/venv/lib/python3.6/site-packages/xgboost/training.py in train(params, dtrain, num_boost_round, evals, obj, feval, maximize, early_stopping_rounds, evals_result, verbose_eval, xgb_model, callbacks)
    207                            evals=evals,
    208                            obj=obj, feval=feval,
--> 209                            xgb_model=xgb_model, callbacks=callbacks)
    210 
    211 

~/Downloads/numerai_datasets/venv/lib/python3.6/site-packages/xgboost/training.py in _train_internal(params, dtrain, num_boost_round, evals, obj, feval, xgb_model, callbacks)
     72         # Skip the first update if it is a recovery step.
     73         if version % 2 == 0:
---> 74             bst.update(dtrain, i, obj)
     75             bst.save_rabit_checkpoint()
     76             version += 1

~/Downloads/numerai_datasets/venv/lib/python3.6/site-packages/xgboost/core.py in update(self, dtrain, iteration, fobj)
   1247             _check_call(_LIB.XGBoosterUpdateOneIter(self.handle,
   1248                                                     ctypes.c_int(iteration),
-> 1249                                                     dtrain.handle))
   1250         else:
   1251             pred = self.predict(dtrain, training=True)

~/Downloads/numerai_datasets/venv/lib/python3.6/site-packages/xgboost/core.py in _check_call(ret)
    187     """
    188     if ret != 0:
--> 189         raise XGBoostError(py_str(_LIB.XGBGetLastError()))
    190 
    191 

XGBoostError: Invalid Parameter format for seed expect int but value='3657279955'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions