[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#50956] [PATCH v2 4/4] gnu: Add python-optuna.
From: |
Vinicius Monego |
Subject: |
[bug#50956] [PATCH v2 4/4] gnu: Add python-optuna. |
Date: |
Wed, 13 Oct 2021 02:00:35 +0000 |
* gnu/packages/machine-learning.scm (python-optuna): New variable.
---
Updated to 2.10.0, added scikit-optimize to native-inputs don't delete the test
file that requires it. Swapped order of native and propagated inputs.
gnu/packages/machine-learning.scm | 93 +++++++++++++++++++++++++++++++
1 file changed, 93 insertions(+)
diff --git a/gnu/packages/machine-learning.scm
b/gnu/packages/machine-learning.scm
index 09767584bb..44033cfb77 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,98 @@ computing environments.")
(home-page "http://dlib.net")
(license license:boost1.0)))
+(define-public python-optuna
+ (package
+ (name "python-optuna")
+ (version "2.10.0")
+ (source
+ (origin
+ (method git-fetch) ; no tests in PyPI tarball
+ (uri (git-reference
+ (url "https://github.com/optuna/optuna")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0fha0pwxq6n3mbpvpz3vk8hh61zqncj5cnq063kzfl5d8rd48vcd"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'dont-check-deps
+ ;; Don't check for test dependencies we don't have.
+ ;; TODO: Package and enable some of these.
+ (lambda _
+ (substitute* "setup.py"
+ ((".*allennlp.*") "")
+ ((".*bokeh.*") "")
+ ((".*catalyst.*") "")
+ ((".*chainer.*") "")
+ ((".*fastai.*") "")
+ ((".*keras.*") "")
+ ((".*lightgbm.*") "")
+ ((".*mlflow.*") "")
+ ((".*mxnet.*") "")
+ ((".*plotly.*") "")
+ ((".*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 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"))))))))
+ (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)
+ ("python-scikit-optimize" ,python-scikit-optimize)
+ ("which" ,which)))
+ (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)))
+ (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