Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
C++ Common Lisp C Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
CL-LIBSVM Common Lisp wrapper for the libsvm support vector machine library by Ravenpack, Gabor Melis. It's under the MIT licence. See COPYING. * Design notes The lisp API tries to protect the programmer from the dangers of C, take care of memory management and wrap everything in CLOS classes while trying not to deviate too much from the original interface so that one can use existing documentation without too much trouble. * API differences PROBLEMs, PARAMETERs and MODELs are represented as CLOS classes. Foreign memory is freed when they are garbage collected. The implementation is based on weak value hash tables (currently for sbcl, allegro and clisp). In the C API, one passes sparse vectors as struct node *, where a node with index -1 denotes the end of the vector. On the lisp side one passes sparse vectors as vectors of index/value conses like (VECTOR (CONS 2 0.1) (CONS 3 0.2)) or as mapper functions. The restrictions that indices should be increasing and not less than 1 still stand, but unlike in C, violations are detected. A mapper for a sparse vector calls the function it is given with index and value parameters. A mapper function that simply maps a vector of conses is: (lambda (fn) (map nil (lambda (c) (funcall fn (car c) (cdr c))) (vector (cons 2 0.1) (cons 3 0.2)))) Mappers abstract away the underlying data structure. Generalized sequences would be nicer, but they only exist in SBCL. One can pass a mapper function instead of a vector anywhere including the TARGETS parameter of TRAIN. It also works for the INPUTS parameter since INPUTS is a vector of sparse vectors one can turn it into a mapper to sparse vector mappers. * Compatibility Tested with libsvm version 2.82, 2.83, 2.86 and 2.88. Some functionality (MODEL-W2S) requires patching the original sources. The distributed sources under lib/src/ contain the necessary changes. In the lib/ directory there are platform specific shared libraries, see the README files for version information. Note that you may want to disable excessive verbosity by changing '#if 1' to '#if 0' around the definition of info in svm.cpp. The precompiled libraries in lib/ contain this change.