File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Java Products and Servers and the fly likes configuring libsvm classifier in weka api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "configuring libsvm classifier in weka api" Watch "configuring libsvm classifier in weka api" New topic

configuring libsvm classifier in weka api

Bob Matthews
Ranch Hand

Joined: Jan 01, 2013
Posts: 76

A question from left field if I may.....................

I am using Windows 7 and weka 3.7.10
I am calling weka (an open source data mining program] in a larger java program
I am attempting to use 7 classifiers
I have 6 working OK with my data but the 7th is a problem
It is libsvm and is a third party classifier
I have followed all the instructions from the weka pages but continue to get the following error message
libsvm.jar is not in the classpath
I have asked at the weka forum but the authors of weka do not have much experience using weka under windows!

Can I improve on my error trapping vode to help identify the 'real' problem?
Should I be thinking of changing my operation system to linux?

That is I have
1) gone to environment variables and added paths to libsvm.jar and LibSVM.jar
2) I have edited runweka.ini and added cp = ...... twice (one for each of the above jar files)

Any suggestions welcome
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46367
Question too difficult for “beginning”. Moving. Maybe to the right place, maybe not
Bob Matthews
Ranch Hand

Joined: Jan 01, 2013
Posts: 76
Hi again

I have just received an email from one of the co-authors of weka stating that I do not have to do either 1) or 2) in my original posting if I am using weka 3.7 (which I am)
and so I have no idea on what to do next?
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Seems to me that all you needed to do was to put libsvm.jar into the classpath used by your application at run time. I don't know what those environment variables you changed were, but it's unnecessary to use any environment variables at all. It might be as simple as just adding libsvm.jar to the list of jars in your -cp parameter at the command line -- if you are using the command line, which you didn't say. At any rate your problem appears to be mostly in setting the classpath. So if you could start by explaining how you run your code, I expect somebody here could explain how to modify that.
Bob Matthews
Ranch Hand

Joined: Jan 01, 2013
Posts: 76
Hi Paul

my code starts with importing com.dukascopy.api
The API has about a dozen sections - one of which is OnBar
Here I decide whether I wish to open a trade
If I do, I do some calculations and then run weka in a loop handling six different classifiers
The code here is:-

try {
new WekaApp().doIt();
catch (Exception e) {

private class WekaApp()
etc. etc.

Is this want you are asking ?

Bob M
Bob Matthews
Ranch Hand

Joined: Jan 01, 2013
Posts: 76
Hi guys

I am desperate for any sort of answer to my problem

Also, I should have stated that by coming away from my java program altogether and simply running weka on its own, I am able to get the classifier LIBSVM selected and used

Bob M
I agree. Here's the link:
subject: configuring libsvm classifier in weka api
It's not a secret anymore!