Subject: [PATCH 2/3] gnu: Add python-skorch.

From: Vinicius Monego <[email-masked]>
Date: Sat, 2 Oct 2021 03:41:16 +0000

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

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 281c88d6f8..fd3e6b2090 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1050,6 +1050,48 @@ number of threads used in the threadpool-backed of common native libraries used
 for scientific computing and data science (e.g. BLAS and OpenMP).")
     (license license:bsd-3)))
 
+(define-public python-skorch
+  (package
+    (name "python-skorch")
+    (version "0.10.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "skorch" version))
+       (sha256
+        (base32 "196hr0q5nw1nzckwanfv27myasayfdxxhx80iv9whm7675rzj44r"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               (invoke "python" "-m" "pytest" "--pyargs" "skorch" "-k"
+                       (string-append
+                        ;; Errors because of missing weight and pickle files.
+                        "not test_load_cuda_params_to_cpu"
+                        " and not test_pickle_load"))))))))
+    (propagated-inputs
+     `(("python-numpy" ,python-numpy)
+       ("python-scikit-learn" ,python-scikit-learn)
+       ("python-scipy" ,python-scipy)
+       ("python-tabulate" ,python-tabulate)
+       ("python-tqdm" ,python-tqdm)))
+    (native-inputs
+     `(("python-flaky" ,python-flaky)
+       ("python-pandas" ,python-pandas)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-cov" ,python-pytest-cov)
+       ("python-pytorch" ,python-pytorch)))
+    (home-page "https://github.com/skorch-dev/skorch")
+    (synopsis "Scikit-learn compatible neural network library for PyTorch")
+    (description "Skorch is a scikit-learn compatible neural network library
+that wraps PyTorch.  It allows to build and train PyTorch models using a
+scikit-learn-like API.")
+    (license license:bsd-3)))
+
 (define-public python-pynndescent
   (package
     (name "python-pynndescent")
-- 
2.30.2