I'm trying to use LibSVM programmatically in Java, via the Weka wrapper written by El-Manzalawy, running on Windows 7. I've added C:\Program Files (x86)\libsvm-3.12\java\libsvm.jar to my CLASSPATH environmental variable. After adding that I can now use LibSVM via the Weka explorer user interface, but it still fails when I'm calling it in code (debugging in eclipse).
I try to create it using Weka.core.Utils.forName. This goes through to LibSVM.java which then calls the java method Class.forName(...), passing CLASS_SVM as the param which is set to "libsvm.svm".
I've used Weka.core.Utils.forName to create others classifiers programmatically without problems.
Anyone have any ideas?
You should be able to glue libsvm and weka in your java program using the answer posted here: How to use LibSVM with Weka in my Java code?
Adding LibSVM is real easy when using Weka 3.7.6, because it allows you to install it via its package manager, either via command line or GUI. So I'd recommend using Weka 3.7.6.
Related
I'm mid-way through a Java project using a '.arpa' file to extract n-gram probabilities.
Ideally I would like to use a '.klm' file (created using the '.arpa' file), similar to:
model = kenlm.LanguageModel('languageModel.klm')
model.score('The dog chased the ball.')
however kenlm for Java isn't supported on windows.
Does anyone know of any alternatives to score sentences?
Thanks.
Resolved by just using a virtual machine to run the project using kenlm
I have used itext in the past where I have created a Java library with a class using the iText jars. This has worked perfectly in the past.
I now have some PDF's the gets corrupted when using setFormFlattening(true), therefor I have tried using the XFAFlattener, and this one works fine.
My problem is that I now need to load a license file via LicenseKey.loadLicenseFile and this works fine if I use my Java class from a Java agent. But if I try to use my Java class form a LotusScript agent, I get an "Certificate not found" error when LicenseKey.loadLicenseFile is called.
I can see that there is a itext.cer certificate inside the itext-licensekey-1.0.3.jar file. I guess it is this certificate that can't be found when running from a LotusScript agent.
Anyone knows how to get this to work?, maybe someone with deep iText knowledge know how this certificate is being loaded from the iText LicenceKey code, and can figure out what the problem can be.
There is no way to read a resource file in Java code if Java code is executed by LS2J.
As a workaround in my LS2J projects, I put the file content into a constant as base64 string and read this instead of resource file.
Another way is to put the code into an Java agent and to call the agent from LotusScript. This way Java code works as expected. Use an in-memory-document to "communicate" between LotusScript and Java.
I'm interested in writing Java to automate the creation of 3D STEP files (CAD format).
There seems to be something for C++ (https://github.com/stepcode/stepcode). There seem to be Java implementations of 3D CAD software (http://brlcad.org/).
However, I don't see an API / Package / Class Library anywhere to build STEP files using Java.
Ideas?
JSDAI is a java API for STEP files and is licensed AGPL.
www.jsdai.net
BIMserver and its friends in Open Source BIM](https://github.com/opensourceBIM) can easily handle this problem without writing a single line of code.
I have downloaded the JNI_SVM-light-6.01-64bit version for running svm in Java. I have tried searching online but did not exactly figure out the steps to run the library using eclipse IDE for java. All I want to do is know how to provide an input training file to train the model, and give a test file so that I get the corresponding results? A step by step instruction to do it using eclipse IDE would be very helpful.
Another way to run SVMLight from Java code in Eclipse is by using ClearTK. This allows for a standardized way to provide data to and get results from not only SVMLight, but also other models such as CRF.
Hey did you check out the test file? I'm trying it out now myself after importing the library by going to build path > Add External Archives.
You can find the test file here:
http://www.mpi-inf.mpg.de/~mtb/svmlight/JNI_SVMLight_Test.java
In the file it creates a random dataset, trains it, calculates the accuracy.. so it's basically giving you the standard operations that you will need.
I am considering using libsvm. Currently, I have transformed my feature vectors to SVM feature vectors format. I am using LibSVM inside a project I will need to somehow use it within my app. The problem is that at the moment all examples available use the command line to provide input to the LibSVM. I don want this.
Can you please give me an example of how I can use it within my code (no calls to the command prompt and no Weka).
Thanks
There are examples in the distribution source code https://github.com/arnaudsj/libsvm/tree/master/java
The applet doesn't use command-line input. Check libsvm-3.11.tar.gz\libsvm-3.11.tar\libsvm-3.11\java