Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check failed: sign == true (0 vs. 1) #3355

Closed
wenyu-z opened this issue Jun 2, 2018 · 4 comments
Closed

Check failed: sign == true (0 vs. 1) #3355

wenyu-z opened this issue Jun 2, 2018 · 4 comments

Comments

@wenyu-z
Copy link

wenyu-z commented Jun 2, 2018

Environment info

Operating System: macOS Sierra

Compiler: spyder

Package used (python/R/jvm/C++): python

xgboost version used: 0.72

  1. The python version and distribution
    Python 2.7.14 :: Anaconda custom (64-bit)
  2. The command to install xgboost if you are not installing from source
    brew install gcc5
    pip install xgboost

Steps to reproduce

I was using the sample code to try it out

import xgboost as xgb
try:
    # read in data
    dtrain = xgb.DMatrix('agaricus_train.txt')
    dtest = xgb.DMatrix('agaricus_test.txt')
    # specify parameters via map
    param = {'max_depth':2, 'eta':1, 'silent':1, 'objective':'binary:logistic' }
    num_round = 2
    bst = xgb.train(param, dtrain, num_round)
    # make prediction
    preds = bst.predict(dtest)

except Exception as e:
    print e

Error Received:

[17:10:37] src/data/././strtonum.h:141: Check failed: sign == true (0 vs. 1) 

Stack trace returned 2 entries:
[bt] (0) 0   libxgboost.dylib                    0x0000001a15606683 dmlc::StackTrace[abi:cxx11]() + 67
[bt] (1) 1   libstdc++.6.dylib                   0x0000001a15a85ce0 vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> > + 16

What have you tried?

I wasn't sure if it was multithreading's problem, so I used the code at https://machinelearningmastery.com/develop-first-xgboost-model-python-scikit-learn/, to use make -j4. But it resulted in another error.

@hcho3
Copy link
Collaborator

hcho3 commented Jun 2, 2018

I was unable to re-produce the problem with the official release 0.72. Can you post the content of agaricus_train.txt? Make sure that the file is a valid LibSVM format.

@wenyu-z
Copy link
Author

wenyu-z commented Jun 2, 2018

Hi @hcho3

agaricus_train.txt
The files are agaricus.txt.train and agaricus.txt.test under /demo/data in the repo. I just renamed them.

@hcho3
Copy link
Collaborator

hcho3 commented Jun 2, 2018

When I opened the file you just posted, I saw bunch of HTML tags. Get the files in raw form and try again.
https://raw.githubusercontent.com/dmlc/xgboost/master/demo/data/agaricus.txt.train
https://raw.githubusercontent.com/dmlc/xgboost/master/demo/data/agaricus.txt.test

@wenyu-z
Copy link
Author

wenyu-z commented Jun 2, 2018

@hcho3 thanks, that solved it! I must've messed something up when I was handling the files

@wenyu-z wenyu-z closed this as completed Jun 2, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants