numerai/example-scripts

example_model.py fails with xgboost 1.4.0

Closed this issue · 4 comments

The script fails with "Floating point is not supported" when running with xgboost 1.4.0 on Ubuntu 20.04.

$ python3 example_model.py
Loading data...
Loaded 310 features
Loading pre-trained model...
Generating predictions...
/home/andrewh/.local/lib/python3.8/site-packages/xgboost/data.py:112: UserWarning: Use subset (sliced data) of np.ndarray is not recommended because it will generate
extra copies and increase memory consumption
warnings.warn(
Traceback (most recent call last):
File "example_model.py", line 236, in
main()
File "example_model.py", line 80, in main
training_data[PREDICTION_NAME] = model.predict(training_data[feature_names])
File "/home/andrewh/.local/lib/python3.8/site-packages/xgboost/sklearn.py", line 820, in predict
predts = self.get_booster().inplace_predict(
File "/home/andrewh/.local/lib/python3.8/site-packages/xgboost/core.py", line 1846, in inplace_predict
_check_call(
File "/home/andrewh/.local/lib/python3.8/site-packages/xgboost/core.py", line 210, in _check_call
raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [21:36:57] ../src/c_api/../data/array_interface.h:352: Floating point is not supported.
Stack trace:
[bt] (0) /home/andrewh/.local/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x912df) [0x7f2f483e62df]
[bt] (1) /home/andrewh/.local/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x9af7f) [0x7f2f483eff7f]
[bt] (2) /home/andrewh/.local/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(XGBoosterPredictFromDense+0xf8) [0x7f2f483d8e78]
[bt] (3) /lib/x86_64-linux-gnu/libffi.so.7(+0x6ff5) [0x7f2f83f6cff5]
[bt] (4) /lib/x86_64-linux-gnu/libffi.so.7(+0x640a) [0x7f2f83f6c40a]
[bt] (5) /usr/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(_ctypes_callproc+0x58c) [0x7f2f8eb122ac]
[bt] (6) /usr/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(+0x137e0) [0x7f2f8eb127e0]
[bt] (7) python3(_PyObject_MakeTpCall+0x296) [0x5f3446]
[bt] (8) python3(_PyEval_EvalFrameDefault+0x5dc0) [0x56f600]

Same issue here... Any help would be welcome.

there is a solution for this?

I find a solution by changing these two lines (57,59):
57 training_data = read_csv("numerai_training_data.csv")
58 # The tournament data is the data that Numerai uses to evaluate your model.
59 tournament_data = read_csv("numerai_tournament_data.csv")
to:
training_data = pd.read_csv("numerai_training_data.csv").set_index("id")
# The tournament data is the data that Numerai uses to evaluate your model.
tournament_data = pd.read_csv("numerai_tournament_data.csv").set_index("id")

seem that the function read_csv not work as expected.

This worked for me too thank you!