summaryrefslogtreecommitdiff
path: root/gnu/packages/machine-learning.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/machine-learning.scm')
-rw-r--r--gnu/packages/machine-learning.scm167
1 files changed, 57 insertions, 110 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index afac56f6f7..509b9c7cdd 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2016, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2020, 2021, 2022 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016, 2017, 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
@@ -16,7 +16,7 @@
;;; Copyright © 2020 Konrad Hinsen <konrad.hinsen@fastmail.net>
;;; Copyright © 2020 Edouard Klein <edk@beaver-labs.com>
;;; Copyright © 2020, 2021, 2022 Vinicius Monego <monego@posteo.net>
-;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1095,8 +1095,13 @@ computing environments.")
(arguments
`(#:phases
(modify-phases %standard-phases
+ (add-before 'build 'configure
+ (lambda _
+ (setenv "SKLEARN_BUILD_PARALLEL"
+ (number->string (parallel-job-count)))))
(add-after 'build 'build-ext
- (lambda _ (invoke "python" "setup.py" "build_ext" "--inplace")))
+ (lambda _ (invoke "python" "setup.py" "build_ext" "--inplace"
+ "-j" (number->string (parallel-job-count)))))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
@@ -1107,13 +1112,15 @@ computing environments.")
(setenv "HOME" "/tmp")
(invoke "pytest" "sklearn" "-m" "not network"
+ "-n" (number->string (parallel-job-count))
;; This test tries to access the internet.
"-k" "not test_load_boston_alternative")))))))
- (inputs
- (list openblas))
+ (inputs (list openblas))
(native-inputs
- (list python-pytest python-pandas ;for tests
- python-cython))
+ (list python-cython
+ python-pandas
+ python-pytest
+ python-pytest-xdist))
(propagated-inputs
(list python-numpy python-threadpoolctl python-scipy python-joblib))
(home-page "https://scikit-learn.org/")
@@ -1121,55 +1128,8 @@ computing environments.")
(description
"Scikit-learn provides simple and efficient tools for data mining and
data analysis.")
- (properties `((python2-variant . ,(delay python2-scikit-learn))))
(license license:bsd-3)))
-;; scikit-learn 0.22 and later only supports Python 3, so we stick with
-;; an older version here.
-(define-public python2-scikit-learn
- (let ((base (package-with-python2 (strip-python2-variant python-scikit-learn))))
- (package
- (inherit base)
- (version "0.20.4")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/scikit-learn/scikit-learn")
- (commit version)))
- (file-name (git-file-name "python-scikit-learn" version))
- (sha256
- (base32
- "08zbzi8yx5wdlxfx9jap61vg1malc9ajf576w7a0liv6jvvrxlpj"))))
- (arguments
- `(#:python ,python-2
- #:phases
- (modify-phases %standard-phases
- (add-after 'build 'build-ext
- (lambda _ (invoke "python" "setup.py" "build_ext" "--inplace")))
- (replace 'check
- (lambda* (#:key tests? #:allow-other-keys)
- (when tests?
- ;; Restrict OpenBLAS threads to prevent segfaults while testing!
- (setenv "OPENBLAS_NUM_THREADS" "1")
-
- ;; Some tests require write access to $HOME.
- (setenv "HOME" "/tmp")
-
- (invoke "pytest" "sklearn" "-m" "not network"
- "-k"
- (string-append
- ;; This test tries to access the internet.
- "not test_load_boston_alternative"
- ;; This test fails for unknown reasons
- " and not test_rank_deficient_design"))))))))
- (inputs
- (list openblas))
- (native-inputs
- (list python2-pytest python2-pandas ;for tests
- python2-cython))
- (propagated-inputs
- (list python2-numpy python2-scipy python2-joblib)))))
-
(define-public python-threadpoolctl
(package
(name "python-threadpoolctl")
@@ -1203,13 +1163,13 @@ for scientific computing and data science (e.g. BLAS and OpenMP).")
(define-public python-pynndescent
(package
(name "python-pynndescent")
- (version "0.5.5")
+ (version "0.5.6")
(source
(origin
(method url-fetch)
(uri (pypi-uri "pynndescent" version))
(sha256
- (base32 "10pqqqc3jkpw03cyzy04slxmpgyhqnlgbyk0c1cv7kqr5d0zhzbs"))))
+ (base32 "0p3jsdcprjfzz7qf5674dsqfpvdn6p4wgqikg7b6ki5abf433yv1"))))
(build-system python-build-system)
(arguments
`(#:phases
@@ -1217,12 +1177,16 @@ for scientific computing and data science (e.g. BLAS and OpenMP).")
(replace 'check
(lambda* (#:key inputs outputs tests? #:allow-other-keys)
(when tests?
- (add-installed-pythonpath inputs outputs)
- (invoke "python" "-m" "pytest" "--pyargs" "pynndescent")))))))
- (native-inputs
- (list python-pytest))
+ (invoke "python" "-m" "pytest" "--pyargs" "pynndescent"
+ ;; wminkowski no longer exists in scipy 1.8.0 (see:
+ ;; https://github.com/lmcinnes/pynndescent/issues/177)
+ "-k" "not test_weighted_minkowski")))))))
+ (native-inputs (list python-pytest))
(propagated-inputs
- (list python-joblib python-llvmlite python-numba python-scikit-learn
+ (list python-joblib
+ python-llvmlite
+ python-numba
+ python-scikit-learn
python-scipy))
(home-page "https://github.com/lmcinnes/pynndescent")
(synopsis "Nearest neighbor descent for approximate nearest neighbors")
@@ -1362,9 +1326,6 @@ forward-mode differentiation, and the two can be composed arbitrarily. The
main intended application of Autograd is gradient-based optimization.")
(license license:expat))))
-(define-public python2-autograd
- (package-with-python2 python-autograd))
-
(define-public lightgbm
(package
(name "lightgbm")
@@ -1451,38 +1412,6 @@ such as online, hashing, allreduce, reductions, learning2search, active, and
interactive learning.")
(license license:bsd-3)))
-(define-public python2-fastlmm
- (package
- (name "python2-fastlmm")
- (version "0.2.21")
- (source
- (origin
- (method url-fetch)
- (uri (pypi-uri "fastlmm" version ".zip"))
- (sha256
- (base32
- "1q8c34rpmwkfy3r4d5172pzdkpfryj561897z9r3x22gq7813x1m"))))
- (build-system python-build-system)
- (arguments
- `(#:tests? #f ; some test files are missing
- #:python ,python-2)) ; only Python 2.7 is supported
- (propagated-inputs
- (list python2-numpy
- python2-scipy
- python2-matplotlib
- python2-pandas
- python2-scikit-learn
- python2-pysnptools))
- (native-inputs
- (list unzip python2-cython python2-mock python2-nose))
- (home-page "http://research.microsoft.com/en-us/um/redmond/projects/mscompbio/fastlmm/")
- (synopsis "Perform genome-wide association studies on large data sets")
- (description
- "FaST-LMM, which stands for Factored Spectrally Transformed Linear Mixed
-Models, is a program for performing both single-SNP and SNP-set genome-wide
-association studies (GWAS) on extremely large data sets.")
- (license license:asl2.0)))
-
(define-public python-hyperopt
(package
(name "python-hyperopt")
@@ -2785,26 +2714,40 @@ These include a barrier, broadcast, and allreduce.")
(define-public python-umap-learn
(package
(name "python-umap-learn")
- (version "0.3.10")
+ (version "0.5.3")
(source
(origin
- (method url-fetch)
- (uri (pypi-uri "umap-learn" version))
+ (method git-fetch) ;no tests in pypi release
+ (uri (git-reference
+ (url "https://github.com/lmcinnes/umap")
+ (commit version)))
+ (file-name (git-file-name name version))
(sha256
(base32
- "02ada2yy6km6zgk2836kg1c97yrcpalvan34p8c57446finnpki1"))))
+ "1315jkb0h1b579y9m59632f0nnpksilm01nxx46in0rq8zna8vsb"))))
(build-system python-build-system)
- (native-inputs
- (list python-joblib python-nose))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (setenv "HOME" "/tmp")
+ (invoke "pytest" "-vv" "umap")))))))
+ (native-inputs (list python-pytest))
(propagated-inputs
- (list python-numba python-numpy python-scikit-learn python-scipy))
+ (list python-numba
+ python-numpy
+ python-pynndescent
+ python-scikit-learn
+ python-scipy
+ python-tqdm))
(home-page "https://github.com/lmcinnes/umap")
- (synopsis
- "Uniform Manifold Approximation and Projection")
- (description
- "Uniform Manifold Approximation and Projection is a dimension reduction
-technique that can be used for visualisation similarly to t-SNE, but also for
-general non-linear dimension reduction.")
+ (synopsis "Uniform Manifold Approximation and Projection")
+ (description "Uniform Manifold Approximation and Projection is a dimension
+reduction technique that can be used for visualization similarly to t-SNE, but
+also for general non-linear dimension reduction.")
(license license:bsd-3)))
(define-public nnpack
@@ -3046,7 +2989,11 @@ Note: currently this package does not provide GPU support.")
(uri (pypi-uri "hmmlearn" version))
(sha256
(base32
- "1my0j3rzp17438idr32ssh0j969a98yjblx5igx5kgiiigr9qa1a"))))
+ "1my0j3rzp17438idr32ssh0j969a98yjblx5igx5kgiiigr9qa1a"))
+ (snippet
+ #~(begin
+ (use-modules ((guix build utils)))
+ (delete-file "lib/hmmlearn/_hmmc.c")))))
(build-system python-build-system)
(arguments
`(#:phases