guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#50956] [PATCH 3/3] gnu: Add python-optuna.


From: Vinicius Monego
Subject: [bug#50956] [PATCH 3/3] gnu: Add python-optuna.
Date: Sat, 2 Oct 2021 03:41:17 +0000

* gnu/packages/machine-learning.scm (python-optuna): New variable.
---
 gnu/packages/machine-learning.scm | 96 +++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)

diff --git a/gnu/packages/machine-learning.scm 
b/gnu/packages/machine-learning.scm
index fd3e6b2090..3b6f709c4e 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -74,6 +74,7 @@
   #:use-module (gnu packages ocaml)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages parallel)
+  #:use-module (gnu packages openstack)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages protobuf)
@@ -938,6 +939,101 @@ computing environments.")
     (home-page "http://dlib.net";)
     (license license:boost1.0)))
 
+(define-public python-optuna
+  (package
+    (name "python-optuna")
+    (version "2.9.1")
+    (source
+     (origin
+       ;; No tests in the PyPI tarball.
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/optuna/optuna";)
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1fx80qjrkmnvn2mg9fx26qn3sjlwnwqlmkaf6sqhdw79pn6khlpi"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'dont-check-deps
+           ;; Don't check for dependencies we don't have or don't need.
+           ;; TODO: Package and enable some of these.
+           (lambda _
+             (substitute* "setup.py"
+               ((".*allennlp.*") "")
+               ((".*bokeh.*") "")
+               ((".*catalyst.*") "")
+               ((".*chainer.*") "")
+               ((".*fastai.*") "")
+               ((".*keras.*") "")
+               ((".*lightgbm.*") "")
+               ((".*mlflow.*") "")
+               ((".*mxnet.*") "")
+               ((".*plotly.*") "")
+               ((".*scikit-optimize.*") "")
+               ((".*skorch.*") "")
+               ((".*tensorflow.*") "")
+               ((".*torch.*") "")
+               ((".*xgboost.*") ""))))
+         (add-after 'unpack 'disable-some-tests
+           (lambda _
+             ;; Integration tests require most of the dependencies above.
+             (delete-file-recursively "tests/integration_tests")
+             ;; TODO: Requires scikit-optimize.
+             (delete-file "tests/samplers_tests/test_samplers.py")
+             ;; TODO: Requires bokeh.
+             (delete-file "tests/test_dashboard.py")
+             ;; FIXME: "Optuna" executable is not found.
+             (delete-file "tests/test_cli.py")
+             ;; FIXME: Files below require plotly but setup fails to identify
+             ;; plotly version and suggests an upgrade to >= 4.0.0.
+             (delete-file "tests/visualization_tests/test_contour.py")
+             (delete-file (string-append "tests/multi_objective_tests/"
+                                         "visualization_tests/"
+                                         "test_pareto_front.py"))
+             (delete-file-recursively "tests/visualization_tests")))
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               (invoke "python" "-m" "pytest" "-k"
+                       ;; redis.exceptions.ResponseError: unknown command 
'TIME'.
+                       (string-append
+                        "not test_retry_failed_trial_callback"
+                        " and not test_failed_trial_callback"
+                        " and not test_fail_stale_trials_with_optimize"))))))))
+    (propagated-inputs
+     `(("python-alembic" ,python-alembic)
+       ("python-cliff" ,python-cliff)
+       ("python-cmaes" ,python-cmaes)
+       ("python-colorlog" ,python-colorlog)
+       ("python-numpy" ,python-numpy)
+       ("python-packaging" ,python-packaging)
+       ("python-pyyaml" ,python-pyyaml)
+       ("python-scipy" ,python-scipy)
+       ("python-sqlalchemy" ,python-sqlalchemy)
+       ("python-tqdm" ,python-tqdm)))
+    (native-inputs
+     `(("python-cma" ,python-cma)
+       ("python-fakeredis" ,python-fakeredis)
+       ("python-matplotlib" ,python-matplotlib)
+       ("python-mpi4py" ,python-mpi4py)
+       ("python-pandas" ,python-pandas)
+       ("python-pytest" ,python-pytest)
+       ("python-redis" ,python-redis)
+       ("python-scikit-learn" ,python-scikit-learn)
+       ("which" ,which)))
+    (home-page "https://optuna.org/";)
+    (synopsis "Hyperparameter optimization framework")
+    (description "Optuna is an automatic hyperparameter optimization software
+framework, particularly designed for machine learning.  It features an
+imperative, @emph{define-by-run} style user API.  Thanks to it, the code
+written with Optuna enjoys high modularity, and the user of Optuna can
+dynamically construct the search spaces for the hyperparameters.")
+    (license license:expat)))
+
 (define-public python-scikit-learn
   (package
     (name "python-scikit-learn")
-- 
2.30.2






reply via email to

[Prev in Thread] Current Thread [Next in Thread]