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

Error while reading model file #9

Open
yannisKork opened this issue Sep 7, 2014 · 2 comments
Open

Error while reading model file #9

yannisKork opened this issue Sep 7, 2014 · 2 comments

Comments

@yannisKork
Copy link

Hi developers,

I am trying to run jlibsvm using the legacyexec programs svm_train and svm_predict. I have successfully run svm_train and produced a model file. Then, I provided this model file as the second attribute of svm_predict, but I get the following error.

Exception in thread "main" edu.berkeley.compbio.jlibsvm.SvmException: Unable to load file models/a2a.m
at edu.berkeley.compbio.jlibsvm.SolutionModel.identifyTypeAndLoad(SolutionModel.java:69)
at svm_predict.main(svm_predict.java:47)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at edu.berkeley.compbio.jlibsvm.SolutionModel.identifyTypeAndLoad(SolutionModel.java:59)
... 1 more
Caused by: java.lang.NullPointerException
at java.util.StringTokenizer.(StringTokenizer.java:199)
at java.util.StringTokenizer.(StringTokenizer.java:236)
at edu.berkeley.compbio.jlibsvm.binary.BinaryModel.(BinaryModel.java:133)
... 6 more

I think the problem lies in BinaryModel. I have tried versions 0.91 and 0.92, but I get the same error. I have also inspected the model file that is produced by svm_train and it seems perfectly logical.

Thanks in advance for your reply!
Yannis

@yannisKork
Copy link
Author

It seems that the model file produced by svm_train is not entirely correct:

svm_type c_svc
RBF gamma=0.008403361774981022label
rho -0.62833524
total_sv 754
nr_class 2
SV
1.0 3:1.0 10:1.0 17:1.0 20:1.0 37:1.0 40:1.0 48:1.0 63:1.0 67:1.0 73:1.0 74:1.0 77:1.0 80:1.0 83:1.0
1.0 5:1.0 7:1.0 17:1.0 22:1.0 36:1.0 40:1.0 56:1.0 63:1.0 67:1.0 73:1.0 74:1.0 76:1.0 80:1.0 83:1.0
....
....

I have figured out that a line defining the label property is missing. Adding "label 0 1" or "label whatever" in the head of the file solves the problem. Can you say why svm_train did not produce the model file correctly?
I used as arguments "sets/a1a models/a1a.m" where a1a is the file downloaded from: http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary.html

Independently of the string following "label", in svm_predict.java, prediction is either true or false, while target is either 1.0 or -1.0. Can you suggest how prediction and target can be aligned?

Thanks again,
Yannis

@gdouchufu
Copy link

sorry,your ‍mail send to the wrong person...‍

------------------ 原始邮件 ------------------
发件人: "yannisKork";[email protected];
发送时间: 2014年9月8日(星期一) 凌晨5:29
收件人: "davidsoergel/jlibsvm"[email protected];

主题: Re: [jlibsvm] Error while reading model file (#9)

It seems that the model file produced by svm_train is not entirely correct:

svm_type c_svc
RBF gamma=0.008403361774981022label
rho -0.62833524
total_sv 754
nr_class 2
SV
1.0 3:1.0 10:1.0 17:1.0 20:1.0 37:1.0 40:1.0 48:1.0 63:1.0 67:1.0 73:1.0 74:1.0 77:1.0 80:1.0 83:1.0
1.0 5:1.0 7:1.0 17:1.0 22:1.0 36:1.0 40:1.0 56:1.0 63:1.0 67:1.0 73:1.0 74:1.0 76:1.0 80:1.0 83:1.0
....
....

I have figured out that a line defining the label property is missing. Adding "label 0 1" or "label whatever" in the head of the file solves the problem. Can you say why svm_train did not produce the model file correctly?
I used as arguments "sets/a1a models/a1a.m" where a1a is the file downloaded from: http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary.html

Independently of the string following "label", in svm_predict.java, prediction is either true or false, while target is either 1.0 or -1.0. Can you suggest how prediction and target can be aligned?

Thanks again,
Yannis


Reply to this email directly or view it on GitHub.

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