davidsoergel / jlibsvm

Efficient training of Support Vector Machines in Java
Other
117 stars 62 forks source link

jLibSVM

Efficient training of Support Vector Machines in Java

Status

This is beta code. While LIBSVM is stable, it's possible that I broke something in the process of refactoring it. I've done ad-hoc testing primarily with the C_SVC machine and an RBF kernel, and got results that were identical to LIBSVM as far as I could tell. There are not (yet?) any unit tests. I'm running some automated verifications that jlibsvm behaves identically to LIBSVM for a number of input datasets and parameter choices; results will be available here soon. Please let me know if you find a situation in which the two packages give different results.

Documentation

Sorry, I haven't really had a chance to write any docs. Have a look at the sources for the command-line programs in the legacyexec package to see how jlibsvm gets called. Very briefly, you'll need to:

  1. instantiate the KernelFunction that you want
  2. set up some parameters in a new SvmParameter object
  3. instantiate a concrete subclass of SvmProblem (binary, multiclass, or regression), and populate it with training data
  4. instantiate a concrete subclass of SVM, choosing a type appropriate for your problem
  5. Call SVM.train(problem) to yield a SolutionModel, which can be used to make predictions

Download

Maven is by far the easiest way to make use of jlibsvm. Just add these to your pom.xml:

<repositories>
    <repository>
        <id>dev.davidsoergel.com releases</id>
        <url>http://dev.davidsoergel.com/nexus/content/repositories/releases</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>dev.davidsoergel.com snapshots</id>
        <url>http://dev.davidsoergel.com/nexus/content/repositories/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>edu.berkeley.compbio</groupId>
        <artifactId>jlibsvm</artifactId>
        <version>0.911</version>
    </dependency>
</dependencies>

If you really want just the jar, you can get the latest release from the Maven repo; or get the latest stable build from the build server.