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.
Common Lisp wrapper for the libsvm support vector machine library.
CL-LIBSVM Common Lisp wrapper for the libsvm support vector machine library by Ravenpack, Gabor Melis. It's under the MIT licence. See COPYING. * D
Information
Category: C/C++ / Miscellaneous |
Watchers: 2 |
Star: 16 |
Fork: 1 |
Last update: Jan 20, 2022 |
Resource links
0 Open
More issues
Closed
I'm getting an unhandled memory fault in liblinear on OSX SBCL, inside liblinear::%train after running (cl-liblinear::test). Did liblinear ever work? I'm using the MacPorts liblinear.
Also, it seems that all of the (foreign-slot-value p 'problem-struct 'y)
etc should be changed to (foreign-slot-value p '(:struct problem-struct) 'y)
to reflect updates in cffi.
opened Jan 5, 2020 by jetmonk 1
Contents
Share this repo
Related Repos
420
100
731
108
125
466
1.4k
617
115