1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
5 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
6 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
8 ;;; Copyright © 2018 Mark Meyer <mark@ofosos.org>
9 ;;; Copyright © 2018 Ben Woodcroft <donttrustben@gmail.com>
10 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages machine-learning)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix utils)
31 #:use-module (guix download)
32 #:use-module (guix svn-download)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system ocaml)
36 #:use-module (guix build-system python)
37 #:use-module (guix build-system r)
38 #:use-module (guix git-download)
39 #:use-module (gnu packages)
40 #:use-module (gnu packages algebra)
41 #:use-module (gnu packages autotools)
42 #:use-module (gnu packages boost)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages compression)
45 #:use-module (gnu packages cran)
46 #:use-module (gnu packages dejagnu)
47 #:use-module (gnu packages gcc)
48 #:use-module (gnu packages image)
49 #:use-module (gnu packages maths)
50 #:use-module (gnu packages mpi)
51 #:use-module (gnu packages ocaml)
52 #:use-module (gnu packages onc-rpc)
53 #:use-module (gnu packages perl)
54 #:use-module (gnu packages pkg-config)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages statistics)
57 #:use-module (gnu packages swig)
58 #:use-module (gnu packages xml)
59 #:use-module (gnu packages xorg))
62 ;; The last release is >100 commits behind, so we package from git.
63 (let ((commit "d71d54788bee56ba4cf7522801270152da5209d7"))
66 (version (string-append "2.2.0-1." (string-take commit 8)))
70 (url "https://github.com/libfann/fann.git")
72 (file-name (string-append name "-" version "-checkout"))
75 "0ibwpfrjs6q2lijs8slxjgzb2llcl6rk3v2ski4r6215g5jjhg3x"))))
76 (build-system cmake-build-system)
79 (modify-phases %standard-phases
81 (lambda* (#:key outputs #:allow-other-keys)
82 (let* ((out (assoc-ref outputs "out")))
83 (with-directory-excursion (string-append (getcwd) "/tests")
84 (invoke "./fann_tests"))))))))
85 (home-page "http://leenissen.dk/fann/wp/")
86 (synopsis "Fast Artificial Neural Network")
88 "FANN is a free open source neural network library, which implements
89 multilayer artificial neural networks in C with support for both fully
90 connected and sparsely connected networks.")
91 (license license:lgpl2.1))))
100 (uri (string-append "https://www.csie.ntu.edu.tw/~cjlin/libsvm/"
101 name "-" version ".tar.gz"))
104 "0zd7s19y5vb7agczl6456bn45cj1y64739sslaskw1qk7dywd0bd"))))
105 (build-system gnu-build-system)
107 `(#:tests? #f ;no "check" target
108 #:phases (modify-phases %standard-phases
111 'install ; no ‘install’ target
112 (lambda* (#:key outputs #:allow-other-keys)
113 (let* ((out (assoc-ref outputs "out"))
114 (bin (string-append out "/bin/")))
116 (for-each (lambda (file)
117 (copy-file file (string-append bin file)))
122 (home-page "http://www.csie.ntu.edu.tw/~cjlin/libsvm/")
123 (synopsis "Library for Support Vector Machines")
125 "LIBSVM is a machine learning library for support vector
126 classification, (C-SVC, nu-SVC), regression (epsilon-SVR, nu-SVR) and
127 distribution estimation (one-class SVM). It supports multi-class
129 (license license:bsd-3)))
131 (define-public python-libsvm
132 (package (inherit libsvm)
133 (name "python-libsvm")
134 (build-system gnu-build-system)
136 `(#:tests? #f ;no "check" target
137 #:make-flags '("-C" "python")
139 (modify-phases %standard-phases
142 'install ; no ‘install’ target
143 (lambda* (#:key inputs outputs #:allow-other-keys)
144 (let ((site (string-append (assoc-ref outputs "out")
148 (assoc-ref inputs "python") 5) 3)
150 (substitute* "python/svm.py"
151 (("../libsvm.so.2") "libsvm.so.2"))
153 (for-each (lambda (file)
154 (copy-file file (string-append site (basename file))))
155 (find-files "python" "\\.py"))
156 (copy-file "libsvm.so.2"
157 (string-append site "libsvm.so.2")))
160 `(("python" ,python)))
161 (synopsis "Python bindings of libSVM")))
164 ;; The latest release candidate is several years and a couple of fixes have
165 ;; been published since. This is why we download the sources from the SVN
167 (let ((svn-revision 2341))
170 (version (string-append "0.9-rc3-0." (number->string svn-revision)))
174 (url "http://svn.code.sf.net/p/ghmm/code/trunk")
175 (revision svn-revision)))
176 (file-name (string-append name "-" version))
179 "0qbq1rqp94l530f043qzp8aw5lj7dng9wq0miffd7spd1ff638wq"))))
180 (build-system gnu-build-system)
182 `(#:imported-modules (,@%gnu-build-system-modules
183 (guix build python-build-system))
185 (modify-phases %standard-phases
186 (add-after 'unpack 'enter-dir
187 (lambda _ (chdir "ghmm") #t))
189 (add-after 'install 'check
190 (assoc-ref %standard-phases 'check))
191 (add-before 'check 'fix-PYTHONPATH
192 (lambda* (#:key inputs outputs #:allow-other-keys)
193 (let ((python-version ((@@ (guix build python-build-system)
195 (assoc-ref inputs "python"))))
197 (string-append (getenv "PYTHONPATH")
198 ":" (assoc-ref outputs "out")
199 "/lib/python" python-version
202 (add-after 'enter-dir 'fix-runpath
203 (lambda* (#:key outputs #:allow-other-keys)
204 (substitute* "ghmmwrapper/setup.py"
205 (("^(.*)extra_compile_args = \\[" line indent)
206 (string-append indent
207 "extra_link_args = [\"-Wl,-rpath="
208 (assoc-ref outputs "out") "/lib\"],\n"
211 (assoc-ref outputs "out")
214 (add-after 'enter-dir 'disable-broken-tests
216 (substitute* "tests/Makefile.am"
217 ;; GHMM_SILENT_TESTS is assumed to be a command.
218 (("TESTS_ENVIRONMENT.*") "")
219 ;; Do not build broken tests.
223 (("label_higher_order_test.*$")
224 "label_higher_order_test\n"))
226 ;; These Python unittests are broken as there is no gato.
227 ;; See https://sourceforge.net/p/ghmm/support-requests/3/
228 (substitute* "ghmmwrapper/ghmmunittests.py"
229 (("^(.*)def (testNewXML|testMultipleTransitionClasses|testNewXML)"
231 (string-append indent
232 "@unittest.skip(\"Disabled by Guix\")\n"
235 (add-after 'disable-broken-tests 'autogen
237 (invoke "bash" "autogen.sh"))))))
239 `(("python" ,python-2) ; only Python 2 is supported
240 ("libxml2" ,libxml2)))
242 `(("pkg-config" ,pkg-config)
245 ("autoconf" ,autoconf)
246 ("automake" ,automake)
247 ("libtool" ,libtool)))
248 (home-page "http://ghmm.org")
249 (synopsis "Hidden Markov Model library")
251 "The General Hidden Markov Model library (GHMM) is a C library with
252 additional Python bindings implementing a wide range of types of @dfn{Hidden
253 Markov Models} (HMM) and algorithms: discrete, continuous emissions, basic
254 training, HMM clustering, HMM mixtures.")
255 (license license:lgpl2.0+))))
264 "http://micans.org/mcl/src/mcl-"
265 (string-replace-substring version "." "-")
269 "15xlax3z31lsn62vlg94hkm75nm40q4679amnfg13jm8m2bnhy5m"))))
270 (build-system gnu-build-system)
272 `(#:configure-flags (list "--enable-blast")))
275 (home-page "http://micans.org/mcl/")
276 (synopsis "Clustering algorithm for graphs")
278 "The MCL algorithm is short for the @dfn{Markov Cluster Algorithm}, a
279 fast and scalable unsupervised cluster algorithm for graphs (also known as
280 networks) based on simulation of (stochastic) flow in graphs.")
281 ;; In the LICENCE file and web page it says "The software is licensed
282 ;; under the GNU General Public License, version 3.", but in several of
283 ;; the source code files it suggests GPL3 or later.
284 ;; http://listserver.ebi.ac.uk/pipermail/mcl-users/2016/000376.html
285 (license license:gpl3)))
287 (define-public ocaml-mcl
290 (version "12-068oasis4")
295 "https://github.com/fhcrc/mcl/archive/"
297 (file-name (string-append name "-" version ".tar.gz"))
300 "1l5jbhwjpsj38x8b9698hfpkv75h8hn3kj0gihjhn8ym2cwwv110"))))
301 (build-system ocaml-build-system)
304 (modify-phases %standard-phases
305 (add-before 'configure 'patch-paths
307 (substitute* "configure"
308 (("SHELL = /bin/sh") (string-append "SHELL = "(which "sh"))))
309 (substitute* "setup.ml"
311 (string-append "LDFLAGS=-fPIC\"; \"SHELL=" (which "sh"))))
313 (home-page "https://github.com/fhcrc/mcl")
314 (synopsis "OCaml wrappers around MCL")
316 "This package provides OCaml bindings for the MCL graph clustering
318 (license license:gpl3)))
320 (define-public ocaml4.01-mcl
321 (package-with-ocaml4.01 ocaml-mcl))
323 (define-public randomjungle
325 (name "randomjungle")
331 "http://www.imbs-luebeck.de/imbs/sites/default/files/u59/"
332 "randomjungle-" version ".tar_.gz"))
335 "12c8rf30cla71swx2mf4ww9mfd8jbdw5lnxd7dxhyw1ygrvg6y4w"))))
336 (build-system gnu-build-system)
339 (list (string-append "--with-boost="
340 (assoc-ref %build-inputs "boost")))
342 (modify-phases %standard-phases
344 'configure 'set-CXXFLAGS
346 (setenv "CXXFLAGS" "-fpermissive ")
354 `(("gfortran" ,gfortran)
355 ("gfortran:lib" ,gfortran "lib")))
356 ;; Non-portable assembly instructions are used so building fails on
357 ;; platforms other than x86_64 or i686.
358 (supported-systems '("x86_64-linux" "i686-linux"))
359 (home-page "http://www.imbs-luebeck.de/imbs/de/node/227/")
360 (synopsis "Implementation of the Random Forests machine learning method")
362 "Random Jungle is an implementation of Random Forests. It is supposed to
363 analyse high dimensional data. In genetics, it can be used for analysing big
364 Genome Wide Association (GWA) data. Random Forests is a powerful machine
365 learning method. Most interesting features are variable selection, missing
366 value imputation, classifier creation, generalization error estimation and
367 sample proximities between pairs of cases.")
368 (license license:gpl3+)))
370 (define-public shogun
378 "ftp://shogun-toolbox.org/shogun/releases/"
379 (version-major+minor version)
380 "/sources/shogun-" version ".tar.bz2"))
383 "1rn9skm3nw6hr7mr3lgp2gfqhi7ii0lyxck7qmqnf8avq349s5jp"))
384 (modules '((guix build utils)
388 ;; Remove non-free sources and files referencing them
389 (for-each delete-file
390 (find-files "src/shogun/classifier/svm/"
391 "SVMLight\\.(cpp|h)"))
392 (for-each delete-file
393 (find-files "examples/undocumented/libshogun/"
395 "(classifier_.*svmlight.*|"
396 "evaluation_cross_validation_locked_comparison).cpp")))
397 ;; Remove non-free functions.
398 (define (delete-ifdefs file)
399 (with-atomic-file-replacement file
401 (let loop ((line (read-line in 'concat))
403 (if (eof-object? line)
408 "#endif //USE_SVMLIGHT" line)))
410 "#ifdef USE_SVMLIGHT" line))))
411 (when (or (not skipping?)
412 (and skipping? (not skip-next?)))
414 (loop (read-line in 'concat) skip-next?)))))))
415 (for-each delete-ifdefs
417 (find-files "src/shogun/classifier/mkl"
418 "^MKLClassification\\.cpp")
419 (find-files "src/shogun/classifier/svm"
420 "^SVMLightOneClass\\.(cpp|h)")
421 (find-files "src/shogun/multiclass"
422 "^ScatterSVM\\.(cpp|h)")
423 (find-files "src/shogun/kernel/"
424 "^(Kernel|CombinedKernel|ProductKernel)\\.(cpp|h)")
425 (find-files "src/shogun/regression/svr"
426 "^(MKLRegression|SVRLight)\\.(cpp|h)")
427 (find-files "src/shogun/transfer/domain_adaptation"
428 "^DomainAdaptationSVM\\.(cpp|h)")))
430 (build-system cmake-build-system)
432 '(#:tests? #f ;no check target
434 (modify-phases %standard-phases
435 (add-after 'unpack 'delete-broken-symlinks
437 (for-each delete-file '("applications/arts/data"
438 "applications/asp/data"
439 "applications/easysvm/data"
440 "applications/msplicer/data"
441 "applications/ocr/data"
443 "examples/undocumented/data"))
445 (add-after 'unpack 'change-R-target-path
446 (lambda* (#:key outputs #:allow-other-keys)
447 (substitute* '("src/interfaces/r/CMakeLists.txt"
448 "examples/meta/r/CMakeLists.txt")
449 (("\\$\\{R_COMPONENT_LIB_PATH\\}")
450 (string-append (assoc-ref outputs "out")
453 (add-after 'unpack 'fix-octave-modules
454 (lambda* (#:key outputs #:allow-other-keys)
455 (substitute* "src/interfaces/octave/CMakeLists.txt"
456 (("^include_directories\\(\\$\\{OCTAVE_INCLUDE_DIRS\\}")
457 "include_directories(${OCTAVE_INCLUDE_DIRS} ${OCTAVE_INCLUDE_DIRS}/octave")
458 ;; change target directory
459 (("\\$\\{OCTAVE_OCT_LOCAL_API_FILE_DIR\\}")
460 (string-append (assoc-ref outputs "out")
461 "/share/octave/packages")))
462 (substitute* '("src/interfaces/octave/swig_typemaps.i"
463 "src/interfaces/octave/sg_print_functions.cpp")
464 ;; "octave/config.h" and "octave/oct-obj.h" deprecated in Octave.
465 (("octave/config\\.h") "octave/octave-config.h")
466 (("octave/oct-obj.h") "octave/ovl.h"))
468 (add-after 'unpack 'move-rxcpp
469 (lambda* (#:key inputs #:allow-other-keys)
470 (let ((rxcpp-dir "shogun/third-party/rxcpp"))
472 (install-file (assoc-ref inputs "rxcpp") rxcpp-dir)
474 (add-before 'build 'set-HOME
475 ;; $HOME needs to be set at some point during the build phase
476 (lambda _ (setenv "HOME" "/tmp") #t)))
478 (list "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
479 "-DUSE_SVMLIGHT=OFF" ;disable proprietary SVMLIGHT
480 "-DBUILD_META_EXAMPLES=OFF" ;requires unpackaged ctags
481 ;;"-DINTERFACE_JAVA=ON" ;requires unpackaged jblas
482 ;;"-DINTERFACE_RUBY=ON" ;requires unpackaged ruby-narray
483 ;;"-DINTERFACE_PERL=ON" ;"FindPerlLibs" does not exist
484 ;;"-DINTERFACE_LUA=ON" ;fails because lua doesn't build pkgconfig file
485 "-DINTERFACE_OCTAVE=ON"
486 "-DINTERFACE_PYTHON=ON"
487 "-DINTERFACE_R=ON")))
490 ("numpy" ,python-numpy)
491 ("r-minimal" ,r-minimal)
497 ("arpack" ,arpack-ng)
504 `(("pkg-config" ,pkg-config)
506 ;; Non-portable SSE instructions are used so building fails on platforms
507 ;; other than x86_64.
508 (supported-systems '("x86_64-linux"))
509 (home-page "http://shogun-toolbox.org/")
510 (synopsis "Machine learning toolbox")
512 "The Shogun Machine learning toolbox provides a wide range of unified and
513 efficient Machine Learning (ML) methods. The toolbox seamlessly allows to
514 combine multiple data representations, algorithm classes, and general purpose
515 tools. This enables both rapid prototyping of data pipelines and extensibility
516 in terms of new algorithms.")
517 (license license:gpl3+)))
526 (uri (string-append "https://github.com/ReactiveX/RxCpp/archive/v"
530 "0y2isr8dy2n1yjr9c5570kpc9lvdlch6jv0jvw000amwn5d3krsh"))
531 (file-name (string-append name "-" version ".tar.gz"))))
532 (build-system cmake-build-system)
535 (modify-phases %standard-phases
536 (add-after 'unpack 'remove-werror
538 (substitute* (find-files ".")
543 (invoke "ctest"))))))
545 `(("catch" ,catch-framework)))
546 (home-page "http://reactivex.io/")
547 (synopsis "Reactive Extensions for C++")
549 "The Reactive Extensions for C++ (RxCpp) is a library of algorithms for
550 values-distributed-in-time. ReactiveX is a library for composing asynchronous
551 and event-based programs by using observable sequences.
553 It extends the observer pattern to support sequences of data and/or events and
554 adds operators that allow you to compose sequences together declaratively while
555 abstracting away concerns about things like low-level threading,
556 synchronization, thread-safety, concurrent data structures, and non-blocking
558 (license license:asl2.0)))
560 (define-public r-adaptivesparsity
562 (name "r-adaptivesparsity")
566 (uri (cran-uri "AdaptiveSparsity" version))
569 "0imr5m8mll9j6n4icsv6z9rl5kbnwsp9wvzrg7n90nnmcxq2cz91"))))
571 `((upstream-name . "AdaptiveSparsity")))
572 (build-system r-build-system)
575 (modify-phases %standard-phases
576 (add-after 'unpack 'link-against-armadillo
578 (substitute* "src/Makevars"
579 (("PKG_LIBS=" prefix)
580 (string-append prefix "-larmadillo"))))))))
583 ("r-matrix" ,r-matrix)
585 ("r-rcpparmadillo" ,r-rcpparmadillo)))
587 `(("armadillo" ,armadillo)))
588 (home-page "https://cran.r-project.org/web/packages/AdaptiveSparsity")
589 (synopsis "Adaptive sparsity models")
591 "This package implements the Figueiredo machine learning algorithm for
592 adaptive sparsity and the Wong algorithm for adaptively sparse gaussian
594 (license license:lgpl3+)))
596 (define-public r-kernlab
603 (uri (cran-uri "kernlab" version))
606 "1m0xqf6gyvwayz7w3c83y32ayvnlz0jicj8ijk808zq9sh7dbbgn"))))
607 (build-system r-build-system)
608 (home-page "https://cran.r-project.org/web/packages/kernlab")
609 (synopsis "Kernel-based machine learning tools")
611 "This package provides kernel-based machine learning methods for
612 classification, regression, clustering, novelty detection, quantile regression
613 and dimensionality reduction. Among other methods @code{kernlab} includes
614 Support Vector Machines, Spectral Clustering, Kernel PCA, Gaussian Processes
616 (license license:gpl2)))
625 "http://dlib.net/files/dlib-" version ".tar.bz2"))
628 "1mljz02kwkrbggyncxv5fpnyjdybw2qihaacb3js8yfkw12vwpc2"))
629 (modules '((guix build utils)))
632 ;; Delete ~13MB of bundled dependencies.
633 (delete-file-recursively "dlib/external")
634 (delete-file-recursively "docs/dlib/external")
636 (build-system cmake-build-system)
639 (modify-phases %standard-phases
640 (add-after 'unpack 'disable-asserts
642 ;; config.h recommends explicitly enabling or disabling asserts
643 ;; when building as a shared library. By default neither is set.
644 (substitute* "dlib/config.h"
645 (("^//#define DLIB_DISABLE_ASSERTS") "#define DLIB_DISABLE_ASSERTS"))
647 (add-after 'disable-asserts 'disable-failing-tests
649 ;; One test times out on MIPS, so we need to disable it.
650 ;; Others are flaky on some platforms.
651 (let* ((system ,(or (%current-target-system)
653 (disabled-tests (cond
654 ((string-prefix? "mips64" system)
655 '("object_detector" ; timeout
657 ((string-prefix? "armhf" system)
658 '("learning_to_track"))
659 ((string-prefix? "i686" system)
664 (substitute* "dlib/test/makefile"
665 (((string-append "SRC \\+= " test "\\.cpp")) "")))
670 ;; No test target, so we build and run the unit tests here.
671 (let ((test-dir (string-append "../dlib-" ,version "/dlib/test")))
672 (with-directory-excursion test-dir
673 (invoke "make" "-j" (number->string (parallel-job-count)))
674 (invoke "./dtest" "--runall"))
676 (add-after 'install 'delete-static-library
677 (lambda* (#:key outputs #:allow-other-keys)
678 (delete-file (string-append (assoc-ref outputs "out")
682 `(("pkg-config" ,pkg-config)
691 ("openblas" ,openblas)
694 "Toolkit for making machine learning and data analysis applications in C++")
696 "Dlib is a modern C++ toolkit containing machine learning algorithms and
697 tools. It is used in both industry and academia in a wide range of domains
698 including robotics, embedded devices, mobile phones, and large high performance
699 computing environments.")
700 (home-page "http://dlib.net")
701 (license license:boost1.0)))
703 (define-public python-scikit-learn
705 (name "python-scikit-learn")
711 (url "https://github.com/scikit-learn/scikit-learn.git")
713 (file-name (git-file-name name version))
716 "1dk9hdj01c0bny4ps78b7869fjw9gr6qklxf6wyql8h6nh4k19xm"))
717 (patches (search-patches
718 "python-scikit-learn-fix-test-non-determinism.patch"))))
719 (build-system python-build-system)
722 (modify-phases %standard-phases
723 (add-after 'build 'build-ext
724 (lambda _ (invoke "python" "setup.py" "build_ext" "--inplace") #t))
727 ;; Restrict OpenBLAS threads to prevent segfaults while testing!
728 (setenv "OPENBLAS_NUM_THREADS" "1")
729 ;; Disable tests that require network access
730 (delete-file "sklearn/datasets/tests/test_mldata.py")
731 (delete-file "sklearn/datasets/tests/test_rcv1.py")
732 (invoke "pytest" "sklearn")
734 ;; FIXME: This fails with permission denied
735 (delete 'reset-gzip-timestamps))))
737 `(("openblas" ,openblas)))
739 `(("python-pytest" ,python-pytest)
740 ("python-pandas" ,python-pandas) ;for tests
741 ("python-cython" ,python-cython)))
743 `(("python-numpy" ,python-numpy)
744 ("python-scipy" ,python-scipy)))
745 (home-page "http://scikit-learn.org/")
746 (synopsis "Machine Learning in Python")
748 "Scikit-learn provides simple and efficient tools for data mining and
750 (license license:bsd-3)))
752 (define-public python2-scikit-learn
753 (let ((parent (package-with-python2 python-scikit-learn)))
754 (package (inherit parent)
756 (substitute-keyword-arguments (package-arguments parent)
758 `(modify-phases ,phases
761 ;; Restrict OpenBLAS threads to prevent segfaults while testing!
762 (setenv "OPENBLAS_NUM_THREADS" "1")
763 ;; Some tests expect to be able to write to HOME.
764 (setenv "HOME" "/tmp")
765 ;; Disable tests that require network access
766 (delete-file "sklearn/datasets/tests/test_kddcup99.py")
767 (delete-file "sklearn/datasets/tests/test_mldata.py")
768 (delete-file "sklearn/datasets/tests/test_rcv1.py")
769 (invoke "pytest" "sklearn")
772 (define-public python-autograd
773 (let* ((commit "442205dfefe407beffb33550846434baa90c4de7")
775 (version (git-version "0.0.0" revision commit)))
777 (name "python-autograd")
778 (home-page "https://github.com/HIPS/autograd")
786 "189sv2xb0mwnjawa9z7mrgdglc1miaq93pnck26r28fi1jdwg0z4"))
787 (file-name (git-file-name name version))))
789 (build-system python-build-system)
791 `(("python-nose" ,python-nose)
792 ("python-pytest" ,python-pytest)))
794 `(("python-future" ,python-future)
795 ("python-numpy" ,python-numpy)))
797 `(#:phases (modify-phases %standard-phases
800 (invoke "py.test" "-v"))))))
801 (synopsis "Efficiently computes derivatives of NumPy code")
802 (description "Autograd can automatically differentiate native Python and
803 NumPy code. It can handle a large subset of Python's features, including loops,
804 ifs, recursion and closures, and it can even take derivatives of derivatives
805 of derivatives. It supports reverse-mode differentiation
806 (a.k.a. backpropagation), which means it can efficiently take gradients of
807 scalar-valued functions with respect to array-valued arguments, as well as
808 forward-mode differentiation, and the two can be composed arbitrarily. The
809 main intended application of Autograd is gradient-based optimization.")
810 (license license:expat))))
812 (define-public python2-autograd
813 (package-with-python2 python-autograd))
815 (define-public lightgbm
822 "https://github.com/Microsoft/LightGBM/archive/v"
826 "132zf0yk0545mg72hyzxm102g3hpb6ixx9hnf8zd2k55gas6cjj1"))
827 (file-name (string-append name "-" version ".tar.gz"))))
829 `(("python-pytest" ,python-pytest)
830 ("python-nose" ,python-nose)))
832 `(("openmpi" ,openmpi)))
834 `(("python-numpy" ,python-numpy)
835 ("python-scipy" ,python-scipy)))
840 (modify-phases %standard-phases
842 (lambda* (#:key outputs #:allow-other-keys)
843 (with-directory-excursion ,(string-append "../LightGBM-" version)
844 (invoke "pytest" "tests/c_api_test/test_.py")))))))
845 (build-system cmake-build-system)
846 (home-page "https://github.com/Microsoft/LightGBM")
847 (synopsis "Gradient boosting framework based on decision tree algorithms")
848 (description "LightGBM is a gradient boosting framework that uses tree
849 based learning algorithms. It is designed to be distributed and efficient with
850 the following advantages:
853 @item Faster training speed and higher efficiency
854 @item Lower memory usage
855 @item Better accuracy
856 @item Parallel and GPU learning supported (not enabled in this package)
857 @item Capable of handling large-scale data
859 (license license:expat)))
861 (define-public vowpal-wabbit
862 ;; Language bindings not included.
864 (name "vowpal-wabbit")
869 "https://github.com/JohnLangford/vowpal_wabbit/archive/"
873 "0clp2kb7rk5sckhllxjr5a651awf4s8dgzg4659yh4hf5cqnf0gr"))
874 (file-name (string-append name "-" version ".tar.gz"))))
880 (list (string-append "--with-boost="
881 (assoc-ref %build-inputs "boost")))))
882 (build-system gnu-build-system)
883 (home-page "https://github.com/JohnLangford/vowpal_wabbit")
884 (synopsis "Fast machine learning library for online learning")
885 (description "Vowpal Wabbit is a machine learning system with techniques
886 such as online, hashing, allreduce, reductions, learning2search, active, and
887 interactive learning.")
888 (license license:bsd-3)))