aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/machine-learning.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2015-06-02 15:10:37 +0200
committerRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2015-06-12 12:57:30 +0200
commit71f80f548741fa61fa3bc2039c296feb1a25d4de (patch)
tree592b2704909de7da6fb10ee4233898e3767088f4 /gnu/packages/machine-learning.scm
parent741115b6490c111f9db7b86964b13bdb22fd6dd0 (diff)
downloadguix-71f80f548741fa61fa3bc2039c296feb1a25d4de.tar
guix-71f80f548741fa61fa3bc2039c296feb1a25d4de.tar.gz
gnu: Add python-libsvm.
* gnu/packages/machine-learning.scm (python-libsvm): New variable.
Diffstat (limited to 'gnu/packages/machine-learning.scm')
-rw-r--r--gnu/packages/machine-learning.scm35
1 files changed, 34 insertions, 1 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 78d7e649a9..b35e9b72c6 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -22,7 +22,8 @@
#:use-module (guix utils)
#:use-module (guix download)
#:use-module (guix build-system gnu)
- #:use-module (gnu packages))
+ #:use-module (gnu packages)
+ #:use-module (gnu packages python))
(define-public libsvm
(package
@@ -63,3 +64,35 @@ classification, (C-SVC, nu-SVC), regression (epsilon-SVR, nu-SVR) and
distribution estimation (one-class SVM). It supports multi-class
classification.")
(license license:bsd-3)))
+
+(define-public python-libsvm
+ (package (inherit libsvm)
+ (name "python-libsvm")
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f ;no "check" target
+ #:make-flags '("-C" "python")
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (replace
+ 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((site (string-append (assoc-ref outputs "out")
+ "/lib/python"
+ (string-take
+ (string-take-right
+ (assoc-ref inputs "python") 5) 3)
+ "/site-packages/")))
+ (substitute* "python/svm.py"
+ (("../libsvm.so.2") "libsvm.so.2"))
+ (mkdir-p site)
+ (for-each (lambda (file)
+ (copy-file file (string-append site (basename file))))
+ (find-files "python" "\\.py"))
+ (copy-file "libsvm.so.2"
+ (string-append site "libsvm.so.2")))
+ #t)))))
+ (inputs
+ `(("python" ,python)))
+ (synopsis "Python bindings of libSVM")))