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

train fails to read input file #36

Closed
christoph-conrads opened this issue Oct 4, 2017 · 3 comments
Closed

train fails to read input file #36

christoph-conrads opened this issue Oct 4, 2017 · 3 comments

Comments

@christoph-conrads
Copy link

According to the LIBLINEAR website, liblinear and libsvm use the same input format. On my computer, train signals an error when it reads an input file that is successfully parsed by libsvm. I traced the different behavior to line 395 in train.c:

		inst_max_index = 0; // strtol gives 0 if wrong format

In libsvm, the same variable is initialized to -1 and changing inst_max_index allows train to read the file successfully, too.

@leepei
Copy link
Contributor

leepei commented Oct 4, 2017

It looks very likely from both issues you posted that your data set feature enumeration starts with 0, while libsvm and liblinear both require it starts from 1. The counter 0 in libsvm is allowed for precomputed kernel only.

@christoph-conrads
Copy link
Author

You are right leepei and here is the relevant line in the libsvm README:

The pair <index>:<value> gives a feature
(attribute) value: <index> is an integer starting from 1 and <value>
is a real number.

@christoph-conrads
Copy link
Author

@leepei Thank you for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants