how to run svm light in java eclipse? - java

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.

Related

API in Java for STEP (p21) - to create STEP compliant files

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.

C++ or Java Library for automated code editing?

I am writing/planning to write a program that takes in a java file (or multiple java files), and edits and adds functions/classes/variables and then outputs a new java file (or multiple files).
Is there a C++ or Java library that
Can recognize and output names of classes/functions within a text file
Can recognize and output the names of the input arguments for said classes/functions
Can allow me to insert code at specific lines or within specific functions
Can search for a given variable name/value
Maintains original file formatting
I would prefer not having to manually code something to do the above, so any help would be appreciated.
Thank you in advance!
EDIT: I currently use Eclipse, and am unsure of how to proceed. So to further explain my question:
In eclipse, if I write a program that opens another .java file, How would I go about 'asking' eclipse to output, say, all the class names of the .java file I just opened?
Also I will explain the 'purpose' of this project to further clarify. I want to write a program that can take in any java file, and turn it into a class that can implemented remotely via RMI. To do this I will need to add an execute() function, have the file implement Task and Serializable and add a few variables, etc... Based on my knowledge, doing this in Eclipse would require manual editing of the program, but I would like to completely automate this process.
Thank you, again.
Much of what you need can be found in a modern IDE; and some very good IDEs are open source (eclipse and Intellij IDEA Community Edition for Java). You might look there to see if there are modules that suite your needs.
Looks like you are talking of a tool like eclipse. You might not be looking for a full fledged IDE, but the requirements that you have mentioned are fulfilled by any basic IDE.
If you wish to make one of your own, you can do that using eclipse rich client platform.
All that you would need from Java is the reflection API.

Java program for Data Processing and Matlab code for results plotting

I am a beginner in the field of Data Mining. I have a data which i need to process before visualizing any useful results. So I do the following:
Preprocess data using Java Program ( Output : txt files) (Input: FileNames)
Convert .txt files to .xls files ( Excel file)
Import excel file in MATLAB
Write Matlab Script to draw some plots on the imported data
I wish to automate this process by just pressing run button and then it happens automatically.
Please guide me how to integrate my work so instead of doing these 4 steps each time i just provide input file names and all the work is done in one go.
Thanks!
You can use arbitrary Java classes from within MATLAB - it is supported to run user-defined classes and even pass data between them and MATLAB. This would give you the following benefits:
no need to write text files/XLS and then import them into matlab
write everything in one MATLAB script - that is what duffymo had in mind, just that you do not need any shell/batch processing. Everything is done in MATLAB
you could add a MATLAB-implemented GUI to handle the process
Have a look at this SO post for some insights.
You want a scripting language: Windows command if you're on that platform; shell scripts on Linux.
It might not be a button, because that implies a UI. You have to write what amounts to an application for that.
The java matlabcontrol library might come in handy
http://code.google.com/p/matlabcontrol/
I had a similar task some time ago. Matlabcontrol is a library which connects MATLAB to your Java program and is quite easy to use.
All steps can be done in Matlab environment.
Java code can be called in Matlab directly. Just add your java class path to Classpath.txt in Matlab and import in the script code.
Maybe CSV data file is better for your case.

java classpath error using LibSVM programmatically within Weka

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.

An example of using LibSVM in java

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

Categories

Resources