Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A Clojure wrapper for LIBLINEAR, a linear support vector machine library
Clojure
Branch: master
Pull request Compare This branch is 1 commit ahead, 23 commits behind lynaghk:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src/clj_liblinear
test/clj_liblinear
.gitignore
LICENSE
README.markdown
project.clj

README.markdown

                                     _ __  
                                    | '_ \ 
                                    | | | |
  /                             \   |_| |_| 
 /                               \        
 |      +             /          |        
 |       +     +     /           |      
 |                  /   -        |      ____  _   _         _  _  _      _  _                            
 |     +    +   +  /  -          |     / ___|| | (_)       | |(_)| |__  | |(_) _ __    ___   __ _  _ __  
 |                /        -     |    | |    | | | | _____ | || || '_ \ | || || '_ \  / _ \ / _` || '__| 
 |     +   +     / -   -         |    | |___ | | | ||_____|| || || |_) || || || | | ||  __/| (_| || |    
 |              /                |     \____||_|_/ |       |_||_||_.__/ |_||_||_| |_| \___| \__,_||_|    
 |    +        /   -    -        |             |__/                                                      
 |          + /      -           |    
 \           /   -               /    
  \                             /                                                           

This is a Clojure wrapper around Benedikt Waldvogel's Java port of LIBLINEAR, a linear classifier that can handle problems with millions of instances and features. Essentially, it is a support vector machine optimized for classes that can be separated without projecting into some fancy-pants kernel space.

(use '[clj-liblinear.core :only [train predict]])
(let [train-data (concat
                  (repeatedly 300 #(hash-map :class 0 :f {:x (rand), :y (rand)}))
                  (repeatedly 300 #(hash-map :class 1 :f {:x (- (rand)), :y (- (rand))})))
      model (train
             (map :f train-data)
             (map :class train-data)
             :algorithm :l2l2)]

  [(predict model {:x (rand) :y (rand)})
   (predict model {:x (- (rand)) :y (- (rand))})])
;;=> [0 1]

Install

Add

[clj-liblinear "0.0.1-SNAPSHOT"]

to the :dependencies vector in your projects.clj file, then run cake deps or lein deps.

If you want to be on the bleeding edge, add this git repository as a submodule on your project:

mkdir vendor
git submodule add https://github.com/lynaghk/clj-liblinear vendor/clj-liblinear

and then setup the classpath appropriately. If you are using cake, for instance, open up <your repo>/.cake/config and add the line

project.classpath = vendor/clj-liblinear/src

Thanks

The National Taiwan University Machine Learning Group for LIBLINEAR, and Benedikt Waldvogel his Java transliteration.

This project is sponsored by Keming Labs, a technical design studio specializing in data visualization.

Something went wrong with that request. Please try again.