gnu: python-scikit-learn: Update to 0.19.1.
[jackhill/guix/guix.git] / gnu / packages / machine-learning.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017 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 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages machine-learning)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix utils)
26 #:use-module (guix download)
27 #:use-module (guix svn-download)
28 #:use-module (guix build-system cmake)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system ocaml)
31 #:use-module (guix build-system python)
32 #:use-module (guix build-system r)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages boost)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages cran)
39 #:use-module (gnu packages dejagnu)
40 #:use-module (gnu packages gcc)
41 #:use-module (gnu packages image)
42 #:use-module (gnu packages maths)
43 #:use-module (gnu packages ocaml)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages statistics)
48 #:use-module (gnu packages swig)
49 #:use-module (gnu packages xml)
50 #:use-module (gnu packages xorg))
51
52 (define-public libsvm
53 (package
54 (name "libsvm")
55 (version "3.20")
56 (source
57 (origin
58 (method url-fetch)
59 (uri (string-append
60 "https://github.com/cjlin1/libsvm/archive/v"
61 (string-delete #\. version) ".tar.gz"))
62 (file-name (string-append name "-" version ".tar.gz"))
63 (sha256
64 (base32
65 "1jpjlql3frjza7zxzrqqr2firh44fjb8fqsdmvz6bjz7sb47zgp4"))))
66 (build-system gnu-build-system)
67 (arguments
68 `(#:tests? #f ;no "check" target
69 #:phases (modify-phases %standard-phases
70 (delete 'configure)
71 (replace
72 'install
73 (lambda* (#:key outputs #:allow-other-keys)
74 (let* ((out (assoc-ref outputs "out"))
75 (bin (string-append out "/bin/")))
76 (mkdir-p bin)
77 (for-each (lambda (file)
78 (copy-file file (string-append bin file)))
79 '("svm-train"
80 "svm-predict"
81 "svm-scale")))
82 #t)))))
83 (home-page "http://www.csie.ntu.edu.tw/~cjlin/libsvm/")
84 (synopsis "Library for Support Vector Machines")
85 (description
86 "LIBSVM is a machine learning library for support vector
87 classification, (C-SVC, nu-SVC), regression (epsilon-SVR, nu-SVR) and
88 distribution estimation (one-class SVM). It supports multi-class
89 classification.")
90 (license license:bsd-3)))
91
92 (define-public python-libsvm
93 (package (inherit libsvm)
94 (name "python-libsvm")
95 (build-system gnu-build-system)
96 (arguments
97 `(#:tests? #f ;no "check" target
98 #:make-flags '("-C" "python")
99 #:phases
100 (modify-phases %standard-phases
101 (delete 'configure)
102 (replace
103 'install
104 (lambda* (#:key inputs outputs #:allow-other-keys)
105 (let ((site (string-append (assoc-ref outputs "out")
106 "/lib/python"
107 (string-take
108 (string-take-right
109 (assoc-ref inputs "python") 5) 3)
110 "/site-packages/")))
111 (substitute* "python/svm.py"
112 (("../libsvm.so.2") "libsvm.so.2"))
113 (mkdir-p site)
114 (for-each (lambda (file)
115 (copy-file file (string-append site (basename file))))
116 (find-files "python" "\\.py"))
117 (copy-file "libsvm.so.2"
118 (string-append site "libsvm.so.2")))
119 #t)))))
120 (inputs
121 `(("python" ,python)))
122 (synopsis "Python bindings of libSVM")))
123
124 (define-public ghmm
125 ;; The latest release candidate is several years and a couple of fixes have
126 ;; been published since. This is why we download the sources from the SVN
127 ;; repository.
128 (let ((svn-revision 2341))
129 (package
130 (name "ghmm")
131 (version (string-append "0.9-rc3-0." (number->string svn-revision)))
132 (source (origin
133 (method svn-fetch)
134 (uri (svn-reference
135 (url "http://svn.code.sf.net/p/ghmm/code/trunk")
136 (revision svn-revision)))
137 (file-name (string-append name "-" version))
138 (sha256
139 (base32
140 "0qbq1rqp94l530f043qzp8aw5lj7dng9wq0miffd7spd1ff638wq"))))
141 (build-system gnu-build-system)
142 (arguments
143 `(#:imported-modules (,@%gnu-build-system-modules
144 (guix build python-build-system))
145 #:phases
146 (modify-phases %standard-phases
147 (add-after 'unpack 'enter-dir
148 (lambda _ (chdir "ghmm") #t))
149 (delete 'check)
150 (add-after 'install 'check
151 (assoc-ref %standard-phases 'check))
152 (add-before 'check 'fix-PYTHONPATH
153 (lambda* (#:key inputs outputs #:allow-other-keys)
154 (let ((python-version ((@@ (guix build python-build-system)
155 get-python-version)
156 (assoc-ref inputs "python"))))
157 (setenv "PYTHONPATH"
158 (string-append (getenv "PYTHONPATH")
159 ":" (assoc-ref outputs "out")
160 "/lib/python" python-version
161 "/site-packages")))
162 #t))
163 (add-after 'enter-dir 'fix-runpath
164 (lambda* (#:key outputs #:allow-other-keys)
165 (substitute* "ghmmwrapper/setup.py"
166 (("^(.*)extra_compile_args = \\[" line indent)
167 (string-append indent
168 "extra_link_args = [\"-Wl,-rpath="
169 (assoc-ref outputs "out") "/lib\"],\n"
170 line
171 "\"-Wl,-rpath="
172 (assoc-ref outputs "out")
173 "/lib\", ")))
174 #t))
175 (add-after 'enter-dir 'disable-broken-tests
176 (lambda _
177 (substitute* "tests/Makefile.am"
178 ;; GHMM_SILENT_TESTS is assumed to be a command.
179 (("TESTS_ENVIRONMENT.*") "")
180 ;; Do not build broken tests.
181 (("chmm .*") "")
182 (("read_fa .*") "")
183 (("mcmc .*") "")
184 (("label_higher_order_test.*$")
185 "label_higher_order_test\n"))
186
187 ;; These Python unittests are broken as there is no gato.
188 ;; See https://sourceforge.net/p/ghmm/support-requests/3/
189 (substitute* "ghmmwrapper/ghmmunittests.py"
190 (("^(.*)def (testNewXML|testMultipleTransitionClasses|testNewXML)"
191 line indent)
192 (string-append indent
193 "@unittest.skip(\"Disabled by Guix\")\n"
194 line)))
195 #t))
196 (add-after 'disable-broken-tests 'autogen
197 (lambda _
198 (zero? (system* "bash" "autogen.sh")))))))
199 (inputs
200 `(("python" ,python-2) ; only Python 2 is supported
201 ("libxml2" ,libxml2)))
202 (native-inputs
203 `(("pkg-config" ,pkg-config)
204 ("dejagnu" ,dejagnu)
205 ("swig" ,swig)
206 ("autoconf" ,autoconf)
207 ("automake" ,automake)
208 ("libtool" ,libtool)))
209 (home-page "http://ghmm.org")
210 (synopsis "Hidden Markov Model library")
211 (description
212 "The General Hidden Markov Model library (GHMM) is a C library with
213 additional Python bindings implementing a wide range of types of @dfn{Hidden
214 Markov Models} (HMM) and algorithms: discrete, continuous emissions, basic
215 training, HMM clustering, HMM mixtures.")
216 (license license:lgpl2.0+))))
217
218 (define-public mcl
219 (package
220 (name "mcl")
221 (version "14.137")
222 (source (origin
223 (method url-fetch)
224 (uri (string-append
225 "http://micans.org/mcl/src/mcl-"
226 (string-replace-substring version "." "-")
227 ".tar.gz"))
228 (sha256
229 (base32
230 "15xlax3z31lsn62vlg94hkm75nm40q4679amnfg13jm8m2bnhy5m"))))
231 (build-system gnu-build-system)
232 (arguments
233 `(#:configure-flags (list "--enable-blast")))
234 (inputs
235 `(("perl" ,perl)))
236 (home-page "http://micans.org/mcl/")
237 (synopsis "Clustering algorithm for graphs")
238 (description
239 "The MCL algorithm is short for the @dfn{Markov Cluster Algorithm}, a
240 fast and scalable unsupervised cluster algorithm for graphs (also known as
241 networks) based on simulation of (stochastic) flow in graphs.")
242 ;; In the LICENCE file and web page it says "The software is licensed
243 ;; under the GNU General Public License, version 3.", but in several of
244 ;; the source code files it suggests GPL3 or later.
245 ;; http://listserver.ebi.ac.uk/pipermail/mcl-users/2016/000376.html
246 (license license:gpl3)))
247
248 (define-public ocaml-mcl
249 (package
250 (name "ocaml-mcl")
251 (version "12-068oasis4")
252 (source
253 (origin
254 (method url-fetch)
255 (uri (string-append
256 "https://github.com/fhcrc/mcl/archive/"
257 version ".tar.gz"))
258 (file-name (string-append name "-" version ".tar.gz"))
259 (sha256
260 (base32
261 "1l5jbhwjpsj38x8b9698hfpkv75h8hn3kj0gihjhn8ym2cwwv110"))))
262 (build-system ocaml-build-system)
263 (arguments
264 `(#:phases
265 (modify-phases %standard-phases
266 (add-before 'configure 'patch-paths
267 (lambda _
268 (substitute* "configure"
269 (("SHELL = /bin/sh") (string-append "SHELL = "(which "sh"))))
270 (substitute* "setup.ml"
271 (("LDFLAGS=-fPIC")
272 (string-append "LDFLAGS=-fPIC\"; \"SHELL=" (which "sh"))))
273 #t)))))
274 (home-page "https://github.com/fhcrc/mcl")
275 (synopsis "OCaml wrappers around MCL")
276 (description
277 "This package provides OCaml bindings for the MCL graph clustering
278 algorithm.")
279 (license license:gpl3)))
280
281 (define-public ocaml4.01-mcl
282 (package-with-ocaml4.01 ocaml-mcl))
283
284 (define-public randomjungle
285 (package
286 (name "randomjungle")
287 (version "2.1.0")
288 (source
289 (origin
290 (method url-fetch)
291 (uri (string-append
292 "http://www.imbs-luebeck.de/imbs/sites/default/files/u59/"
293 "randomjungle-" version ".tar_.gz"))
294 (sha256
295 (base32
296 "12c8rf30cla71swx2mf4ww9mfd8jbdw5lnxd7dxhyw1ygrvg6y4w"))))
297 (build-system gnu-build-system)
298 (arguments
299 `(#:configure-flags
300 (list (string-append "--with-boost="
301 (assoc-ref %build-inputs "boost")))
302 #:phases
303 (modify-phases %standard-phases
304 (add-before
305 'configure 'set-CXXFLAGS
306 (lambda _
307 (setenv "CXXFLAGS" "-fpermissive ")
308 #t)))))
309 (inputs
310 `(("boost" ,boost)
311 ("gsl" ,gsl)
312 ("libxml2" ,libxml2)
313 ("zlib" ,zlib)))
314 (native-inputs
315 `(("gfortran" ,gfortran)
316 ("gfortran:lib" ,gfortran "lib")))
317 ;; Non-portable assembly instructions are used so building fails on
318 ;; platforms other than x86_64 or i686.
319 (supported-systems '("x86_64-linux" "i686-linux"))
320 (home-page "http://www.imbs-luebeck.de/imbs/de/node/227/")
321 (synopsis "Implementation of the Random Forests machine learning method")
322 (description
323 "Random Jungle is an implementation of Random Forests. It is supposed to
324 analyse high dimensional data. In genetics, it can be used for analysing big
325 Genome Wide Association (GWA) data. Random Forests is a powerful machine
326 learning method. Most interesting features are variable selection, missing
327 value imputation, classifier creation, generalization error estimation and
328 sample proximities between pairs of cases.")
329 (license license:gpl3+)))
330
331 (define-public shogun
332 (package
333 (name "shogun")
334 (version "4.0.0")
335 (source
336 (origin
337 (method url-fetch)
338 (uri (string-append
339 "ftp://shogun-toolbox.org/shogun/releases/"
340 (version-major+minor version)
341 "/sources/shogun-" version ".tar.bz2"))
342 (sha256
343 (base32
344 "159nlijnb7mnrv9za80wnm1shwvy45hgrqzn51hxy7gw4z6d6fdb"))
345 (modules '((guix build utils)
346 (ice-9 rdelim)))
347 (snippet
348 '(begin
349 ;; Remove non-free sources and files referencing them
350 (for-each delete-file
351 (find-files "src/shogun/classifier/svm/"
352 "SVMLight\\.(cpp|h)"))
353 (for-each delete-file
354 (find-files "examples/undocumented/libshogun/"
355 (string-append
356 "(classifier_.*svmlight.*|"
357 "evaluation_cross_validation_locked_comparison).cpp")))
358 ;; Remove non-free functions.
359 (define (delete-ifdefs file)
360 (with-atomic-file-replacement file
361 (lambda (in out)
362 (let loop ((line (read-line in 'concat))
363 (skipping? #f))
364 (if (eof-object? line)
365 #t
366 (let ((skip-next?
367 (or (and skipping?
368 (not (string-prefix?
369 "#endif //USE_SVMLIGHT" line)))
370 (string-prefix?
371 "#ifdef USE_SVMLIGHT" line))))
372 (when (or (not skipping?)
373 (and skipping? (not skip-next?)))
374 (display line out))
375 (loop (read-line in 'concat) skip-next?)))))))
376 (for-each delete-ifdefs (find-files "src/shogun/kernel/"
377 "^Kernel\\.(cpp|h)"))))))
378 (build-system cmake-build-system)
379 (arguments
380 '(#:tests? #f ;no check target
381 #:phases
382 (modify-phases %standard-phases
383 (add-after 'unpack 'delete-broken-symlinks
384 (lambda _
385 (for-each delete-file '("applications/arts/data"
386 "applications/asp/data"
387 "applications/easysvm/data"
388 "applications/msplicer/data"
389 "applications/ocr/data"
390 "examples/documented/data"
391 "examples/documented/matlab_static"
392 "examples/documented/octave_static"
393 "examples/undocumented/data"
394 "examples/undocumented/matlab_static"
395 "examples/undocumented/octave_static"
396 "tests/integration/data"
397 "tests/integration/matlab_static"
398 "tests/integration/octave_static"
399 "tests/integration/python_modular/tests"))
400 #t))
401 (add-after 'unpack 'change-R-target-path
402 (lambda* (#:key outputs #:allow-other-keys)
403 (substitute* '("src/interfaces/r_modular/CMakeLists.txt"
404 "src/interfaces/r_static/CMakeLists.txt"
405 "examples/undocumented/r_modular/CMakeLists.txt")
406 (("\\$\\{R_COMPONENT_LIB_PATH\\}")
407 (string-append (assoc-ref outputs "out")
408 "/lib/R/library/")))
409 #t))
410 (add-after 'unpack 'fix-octave-modules
411 (lambda* (#:key outputs #:allow-other-keys)
412 (substitute* '("src/interfaces/octave_modular/CMakeLists.txt"
413 "src/interfaces/octave_static/CMakeLists.txt")
414 (("^include_directories\\(\\$\\{OCTAVE_INCLUDE_DIRS\\}")
415 "include_directories(${OCTAVE_INCLUDE_DIRS} ${OCTAVE_INCLUDE_DIRS}/octave"))
416
417 ;; change target directory
418 (substitute* "src/interfaces/octave_modular/CMakeLists.txt"
419 (("\\$\\{OCTAVE_OCT_LOCAL_API_FILE_DIR\\}")
420 (string-append (assoc-ref outputs "out")
421 "/share/octave/packages")))
422 #t))
423 (add-before 'build 'set-HOME
424 ;; $HOME needs to be set at some point during the build phase
425 (lambda _ (setenv "HOME" "/tmp") #t)))
426 #:configure-flags
427 (list "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
428 "-DUSE_SVMLIGHT=OFF" ;disable proprietary SVMLIGHT
429 ;;"-DJavaModular=ON" ;requires unpackaged jblas
430 ;;"-DRubyModular=ON" ;requires unpackaged ruby-narray
431 ;;"-DPerlModular=ON" ;"FindPerlLibs" does not exist
432 ;;"-DLuaModular=ON" ;fails because lua doesn't build pkgconfig file
433 "-DOctaveModular=ON"
434 "-DOctaveStatic=ON"
435 "-DPythonModular=ON"
436 "-DPythonStatic=ON"
437 "-DRModular=ON"
438 "-DRStatic=ON"
439 "-DCmdLineStatic=ON")))
440 (inputs
441 `(("python" ,python)
442 ("numpy" ,python-numpy)
443 ("r-minimal" ,r-minimal)
444 ("octave" ,octave)
445 ("swig" ,swig)
446 ("hdf5" ,hdf5)
447 ("atlas" ,atlas)
448 ("arpack" ,arpack-ng)
449 ("lapack" ,lapack)
450 ("glpk" ,glpk)
451 ("libxml2" ,libxml2)
452 ("lzo" ,lzo)
453 ("zlib" ,zlib)))
454 (native-inputs
455 `(("pkg-config" ,pkg-config)))
456 ;; Non-portable SSE instructions are used so building fails on platforms
457 ;; other than x86_64.
458 (supported-systems '("x86_64-linux"))
459 (home-page "http://shogun-toolbox.org/")
460 (synopsis "Machine learning toolbox")
461 (description
462 "The Shogun Machine learning toolbox provides a wide range of unified and
463 efficient Machine Learning (ML) methods. The toolbox seamlessly allows to
464 combine multiple data representations, algorithm classes, and general purpose
465 tools. This enables both rapid prototyping of data pipelines and extensibility
466 in terms of new algorithms.")
467 (license license:gpl3+)))
468
469 (define-public r-adaptivesparsity
470 (package
471 (name "r-adaptivesparsity")
472 (version "1.4")
473 (source (origin
474 (method url-fetch)
475 (uri (cran-uri "AdaptiveSparsity" version))
476 (sha256
477 (base32
478 "1az7isvalf3kmdiycrfl6s9k9xqk22k1mc6rh8v0jmcz402qyq8z"))))
479 (properties
480 `((upstream-name . "AdaptiveSparsity")))
481 (build-system r-build-system)
482 (arguments
483 `(#:phases
484 (modify-phases %standard-phases
485 (add-after 'unpack 'link-against-armadillo
486 (lambda _
487 (substitute* "src/Makevars"
488 (("PKG_LIBS=" prefix)
489 (string-append prefix "-larmadillo"))))))))
490 (propagated-inputs
491 `(("r-rcpp" ,r-rcpp)
492 ("r-rcpparmadillo" ,r-rcpparmadillo)))
493 (inputs
494 `(("armadillo" ,armadillo)))
495 (home-page "http://cran.r-project.org/web/packages/AdaptiveSparsity")
496 (synopsis "Adaptive sparsity models")
497 (description
498 "This package implements the Figueiredo machine learning algorithm for
499 adaptive sparsity and the Wong algorithm for adaptively sparse gaussian
500 geometric models.")
501 (license license:lgpl3+)))
502
503 (define-public r-kernlab
504 (package
505 (name "r-kernlab")
506 (version "0.9-25")
507 (source
508 (origin
509 (method url-fetch)
510 (uri (cran-uri "kernlab" version))
511 (sha256
512 (base32
513 "0qnaq9x3j2xc6jrmmd98wc6hkzch487s4p3a9lnc00xvahkhgpmr"))))
514 (build-system r-build-system)
515 (home-page "http://cran.r-project.org/web/packages/kernlab")
516 (synopsis "Kernel-based machine learning tools")
517 (description
518 "This package provides kernel-based machine learning methods for
519 classification, regression, clustering, novelty detection, quantile regression
520 and dimensionality reduction. Among other methods @code{kernlab} includes
521 Support Vector Machines, Spectral Clustering, Kernel PCA, Gaussian Processes
522 and a QP solver.")
523 (license license:gpl2)))
524
525 (define-public dlib
526 (package
527 (name "dlib")
528 (version "19.7")
529 (source (origin
530 (method url-fetch)
531 (uri (string-append
532 "http://dlib.net/files/dlib-" version ".tar.bz2"))
533 (sha256
534 (base32
535 "1mljz02kwkrbggyncxv5fpnyjdybw2qihaacb3js8yfkw12vwpc2"))
536 (modules '((guix build utils)))
537 (snippet
538 '(begin
539 ;; Delete ~13MB of bundled dependencies.
540 (delete-file-recursively "dlib/external")
541 (delete-file-recursively "docs/dlib/external")
542 #t))))
543 (build-system cmake-build-system)
544 (arguments
545 ;; Recent releases defaults to "lib64" on 64bit.
546 `(#:configure-flags (list (string-append "-DCMAKE_INSTALL_LIBDIR="
547 (assoc-ref %outputs "out")
548 "/lib"))
549 #:phases
550 (modify-phases %standard-phases
551 (add-after 'unpack 'disable-asserts
552 (lambda _
553 ;; config.h recommends explicitly enabling or disabling asserts
554 ;; when building as a shared library. By default neither is set.
555 (substitute* "dlib/config.h"
556 (("^//#define DLIB_DISABLE_ASSERTS") "#define DLIB_DISABLE_ASSERTS"))
557 #t))
558 (add-after 'disable-asserts 'disable-failing-tests
559 (lambda _
560 ;; One test times out on MIPS, so we need to disable it.
561 ;; Others are flaky on some platforms.
562 (let* ((system ,(or (%current-target-system)
563 (%current-system)))
564 (disabled-tests (cond
565 ((string-prefix? "mips64" system)
566 '("object_detector" ; timeout
567 "data_io"))
568 ((string-prefix? "armhf" system)
569 '("learning_to_track"))
570 ((string-prefix? "i686" system)
571 '("optimization"))
572 (else '()))))
573 (for-each
574 (lambda (test)
575 (substitute* "dlib/test/makefile"
576 (((string-append "SRC \\+= " test "\\.cpp")) "")))
577 disabled-tests)
578 #t)))
579 (replace 'check
580 (lambda _
581 ;; No test target, so we build and run the unit tests here.
582 (let ((test-dir (string-append "../dlib-" ,version "/dlib/test")))
583 (with-directory-excursion test-dir
584 (and (zero? (system* "make" "-j" (number->string (parallel-job-count))))
585 (zero? (system* "./dtest" "--runall")))))))
586 (add-after 'install 'delete-static-library
587 (lambda* (#:key outputs #:allow-other-keys)
588 (delete-file (string-append (assoc-ref outputs "out")
589 "/lib/libdlib.a"))
590 #t)))))
591 (native-inputs
592 `(("pkg-config" ,pkg-config)))
593 (inputs
594 `(("giflib" ,giflib)
595 ("lapack" ,lapack)
596 ("libjpeg" ,libjpeg)
597 ("libpng" ,libpng)
598 ("libx11" ,libx11)
599 ("openblas" ,openblas)
600 ("zlib" ,zlib)))
601 (synopsis
602 "Toolkit for making machine learning and data analysis applications in C++")
603 (description
604 "Dlib is a modern C++ toolkit containing machine learning algorithms and
605 tools. It is used in both industry and academia in a wide range of domains
606 including robotics, embedded devices, mobile phones, and large high performance
607 computing environments.")
608 (home-page "http://dlib.net")
609 (license license:boost1.0)))
610
611 (define-public python-scikit-learn
612 (package
613 (name "python-scikit-learn")
614 (version "0.19.1")
615 (source
616 (origin
617 (method url-fetch)
618 (uri (string-append
619 "https://github.com/scikit-learn/scikit-learn/archive/"
620 version ".tar.gz"))
621 (file-name (string-append name "-" version ".tar.gz"))
622 (sha256
623 (base32
624 "18n8775kyfwbvcjjjzda9c5sqy4737c0hrmj6qj1ps2jmlqzair9"))))
625 (build-system python-build-system)
626 (arguments
627 `(#:phases
628 (modify-phases %standard-phases
629 (delete 'check)
630 (add-after 'install 'check
631 ;; Running tests from the source directory requires
632 ;; an "inplace" build with paths relative to CWD.
633 ;; http://scikit-learn.org/stable/developers/advanced_installation.html#testing
634 ;; Use the installed version instead.
635 (lambda* (#:key inputs outputs #:allow-other-keys)
636 (add-installed-pythonpath inputs outputs)
637 ;; some tests require access to "$HOME"
638 (setenv "HOME" "/tmp")
639 ;; Step out of the source directory just to be sure.
640 (chdir "..")
641 (zero? (system* "nosetests" "-v" "sklearn")))))))
642 (inputs
643 `(("openblas" ,openblas)))
644 (native-inputs
645 `(("python-nose" ,python-nose)
646 ("python-cython" ,python-cython)))
647 (propagated-inputs
648 `(("python-numpy" ,python-numpy)
649 ("python-scipy" ,python-scipy)))
650 (home-page "http://scikit-learn.org/")
651 (synopsis "Machine Learning in Python")
652 (description
653 "Scikit-learn provides simple and efficient tools for data
654 mining and data analysis.")
655 (license license:bsd-3)))
656
657 (define-public python2-scikit-learn
658 (package-with-python2 python-scikit-learn))