Commit | Line | Data |
---|---|---|
741115b6 | 1 | ;;; GNU Guix --- Functional package management for GNU |
7d4cab74 | 2 | ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net> |
25e0037a | 3 | ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il> |
be6eb2f1 RW |
4 | ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com> |
5 | ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com> | |
5ed72097 | 6 | ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
3a354e10 | 7 | ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net> |
a9b34762 MM |
8 | ;;; Copyright © 2018 Mark Meyer <mark@ofosos.org> |
9 | ;;; Copyright © 2018 Ben Woodcroft <donttrustben@gmail.com> | |
2dab4188 | 10 | ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com> |
564cf93f | 11 | ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu> |
df4c8434 | 12 | ;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de> |
d60b064d | 13 | ;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr> |
741115b6 RW |
14 | ;;; |
15 | ;;; This file is part of GNU Guix. | |
16 | ;;; | |
17 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
18 | ;;; under the terms of the GNU General Public License as published by | |
19 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
20 | ;;; your option) any later version. | |
21 | ;;; | |
22 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
23 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 | ;;; GNU General Public License for more details. | |
26 | ;;; | |
27 | ;;; You should have received a copy of the GNU General Public License | |
28 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
29 | ||
30 | (define-module (gnu packages machine-learning) | |
31 | #:use-module ((guix licenses) #:prefix license:) | |
32 | #:use-module (guix packages) | |
33 | #:use-module (guix utils) | |
34 | #:use-module (guix download) | |
23aab4ab | 35 | #:use-module (guix svn-download) |
c1670a81 | 36 | #:use-module (guix build-system cmake) |
741115b6 | 37 | #:use-module (guix build-system gnu) |
0a3063d6 | 38 | #:use-module (guix build-system ocaml) |
be6eb2f1 | 39 | #:use-module (guix build-system python) |
8406138b | 40 | #:use-module (guix build-system r) |
a9b34762 | 41 | #:use-module (guix git-download) |
71f80f54 | 42 | #:use-module (gnu packages) |
0dfeb285 | 43 | #:use-module (gnu packages adns) |
5a14e81e | 44 | #:use-module (gnu packages algebra) |
b9445d0b | 45 | #:use-module (gnu packages audio) |
23aab4ab | 46 | #:use-module (gnu packages autotools) |
b9445d0b | 47 | #:use-module (gnu packages base) |
99260014 | 48 | #:use-module (gnu packages bash) |
0931c609 | 49 | #:use-module (gnu packages boost) |
be6eb2f1 | 50 | #:use-module (gnu packages check) |
0931c609 | 51 | #:use-module (gnu packages compression) |
9e37e537 | 52 | #:use-module (gnu packages cran) |
4fa16c9a | 53 | #:use-module (gnu packages databases) |
23aab4ab | 54 | #:use-module (gnu packages dejagnu) |
0931c609 | 55 | #:use-module (gnu packages gcc) |
b9445d0b | 56 | #:use-module (gnu packages glib) |
f1765b57 | 57 | #:use-module (gnu packages graphviz) |
b9445d0b | 58 | #:use-module (gnu packages gstreamer) |
5f0ff6a9 | 59 | #:use-module (gnu packages image) |
b9445d0b | 60 | #:use-module (gnu packages linux) |
0931c609 | 61 | #:use-module (gnu packages maths) |
112c2c01 | 62 | #:use-module (gnu packages mpi) |
0a3063d6 | 63 | #:use-module (gnu packages ocaml) |
3929f46c | 64 | #:use-module (gnu packages onc-rpc) |
791c11d6 | 65 | #:use-module (gnu packages perl) |
c1670a81 | 66 | #:use-module (gnu packages pkg-config) |
0dfeb285 | 67 | #:use-module (gnu packages protobuf) |
0931c609 | 68 | #:use-module (gnu packages python) |
10451f6b | 69 | #:use-module (gnu packages python-web) |
44d10b1f | 70 | #:use-module (gnu packages python-xyz) |
4fa16c9a | 71 | #:use-module (gnu packages serialization) |
f1765b57 | 72 | #:use-module (gnu packages sphinx) |
c1670a81 | 73 | #:use-module (gnu packages statistics) |
4fa16c9a | 74 | #:use-module (gnu packages sqlite) |
c1670a81 | 75 | #:use-module (gnu packages swig) |
0dfeb285 | 76 | #:use-module (gnu packages tls) |
99260014 | 77 | #:use-module (gnu packages web) |
5f0ff6a9 | 78 | #:use-module (gnu packages xml) |
39bb4937 RW |
79 | #:use-module (gnu packages xorg) |
80 | #:use-module (ice-9 match)) | |
741115b6 | 81 | |
a9b34762 MM |
82 | (define-public fann |
83 | ;; The last release is >100 commits behind, so we package from git. | |
84 | (let ((commit "d71d54788bee56ba4cf7522801270152da5209d7")) | |
85 | (package | |
86 | (name "fann") | |
87 | (version (string-append "2.2.0-1." (string-take commit 8))) | |
88 | (source (origin | |
89 | (method git-fetch) | |
90 | (uri (git-reference | |
91 | (url "https://github.com/libfann/fann.git") | |
92 | (commit commit))) | |
93 | (file-name (string-append name "-" version "-checkout")) | |
94 | (sha256 | |
95 | (base32 | |
96 | "0ibwpfrjs6q2lijs8slxjgzb2llcl6rk3v2ski4r6215g5jjhg3x")))) | |
97 | (build-system cmake-build-system) | |
98 | (arguments | |
99 | `(#:phases | |
100 | (modify-phases %standard-phases | |
101 | (replace 'check | |
102 | (lambda* (#:key outputs #:allow-other-keys) | |
103 | (let* ((out (assoc-ref outputs "out"))) | |
104 | (with-directory-excursion (string-append (getcwd) "/tests") | |
105 | (invoke "./fann_tests")))))))) | |
106 | (home-page "http://leenissen.dk/fann/wp/") | |
107 | (synopsis "Fast Artificial Neural Network") | |
108 | (description | |
109 | "FANN is a free open source neural network library, which implements | |
110 | multilayer artificial neural networks in C with support for both fully | |
111 | connected and sparsely connected networks.") | |
112 | (license license:lgpl2.1)))) | |
113 | ||
741115b6 RW |
114 | (define-public libsvm |
115 | (package | |
116 | (name "libsvm") | |
2cffa2f2 | 117 | (version "3.23") |
741115b6 RW |
118 | (source |
119 | (origin | |
120 | (method url-fetch) | |
d1308c5e TGR |
121 | (uri (string-append "https://www.csie.ntu.edu.tw/~cjlin/libsvm/" |
122 | name "-" version ".tar.gz")) | |
741115b6 | 123 | (sha256 |
2cffa2f2 | 124 | (base32 "0jpaq0rr92x38p4nk3gjan79ip67m6p80anb28z1d8601miysyi5")))) |
741115b6 RW |
125 | (build-system gnu-build-system) |
126 | (arguments | |
2cffa2f2 | 127 | `(#:tests? #f ; no "check" target |
741115b6 RW |
128 | #:phases (modify-phases %standard-phases |
129 | (delete 'configure) | |
130 | (replace | |
d1308c5e | 131 | 'install ; no ‘install’ target |
741115b6 RW |
132 | (lambda* (#:key outputs #:allow-other-keys) |
133 | (let* ((out (assoc-ref outputs "out")) | |
134 | (bin (string-append out "/bin/"))) | |
135 | (mkdir-p bin) | |
136 | (for-each (lambda (file) | |
137 | (copy-file file (string-append bin file))) | |
138 | '("svm-train" | |
139 | "svm-predict" | |
140 | "svm-scale"))) | |
141 | #t))))) | |
142 | (home-page "http://www.csie.ntu.edu.tw/~cjlin/libsvm/") | |
143 | (synopsis "Library for Support Vector Machines") | |
144 | (description | |
145 | "LIBSVM is a machine learning library for support vector | |
146 | classification, (C-SVC, nu-SVC), regression (epsilon-SVR, nu-SVR) and | |
147 | distribution estimation (one-class SVM). It supports multi-class | |
148 | classification.") | |
149 | (license license:bsd-3))) | |
71f80f54 RW |
150 | |
151 | (define-public python-libsvm | |
152 | (package (inherit libsvm) | |
153 | (name "python-libsvm") | |
154 | (build-system gnu-build-system) | |
155 | (arguments | |
2cffa2f2 | 156 | `(#:tests? #f ; no "check" target |
71f80f54 RW |
157 | #:make-flags '("-C" "python") |
158 | #:phases | |
159 | (modify-phases %standard-phases | |
160 | (delete 'configure) | |
161 | (replace | |
d1308c5e | 162 | 'install ; no ‘install’ target |
71f80f54 RW |
163 | (lambda* (#:key inputs outputs #:allow-other-keys) |
164 | (let ((site (string-append (assoc-ref outputs "out") | |
165 | "/lib/python" | |
166 | (string-take | |
167 | (string-take-right | |
168 | (assoc-ref inputs "python") 5) 3) | |
169 | "/site-packages/"))) | |
170 | (substitute* "python/svm.py" | |
171 | (("../libsvm.so.2") "libsvm.so.2")) | |
172 | (mkdir-p site) | |
173 | (for-each (lambda (file) | |
174 | (copy-file file (string-append site (basename file)))) | |
175 | (find-files "python" "\\.py")) | |
176 | (copy-file "libsvm.so.2" | |
177 | (string-append site "libsvm.so.2"))) | |
178 | #t))))) | |
179 | (inputs | |
180 | `(("python" ,python))) | |
181 | (synopsis "Python bindings of libSVM"))) | |
0931c609 | 182 | |
23aab4ab RW |
183 | (define-public ghmm |
184 | ;; The latest release candidate is several years and a couple of fixes have | |
185 | ;; been published since. This is why we download the sources from the SVN | |
186 | ;; repository. | |
187 | (let ((svn-revision 2341)) | |
188 | (package | |
189 | (name "ghmm") | |
190 | (version (string-append "0.9-rc3-0." (number->string svn-revision))) | |
191 | (source (origin | |
192 | (method svn-fetch) | |
193 | (uri (svn-reference | |
194 | (url "http://svn.code.sf.net/p/ghmm/code/trunk") | |
195 | (revision svn-revision))) | |
e3a69938 | 196 | (file-name (string-append name "-" version "-checkout")) |
23aab4ab RW |
197 | (sha256 |
198 | (base32 | |
199 | "0qbq1rqp94l530f043qzp8aw5lj7dng9wq0miffd7spd1ff638wq")))) | |
200 | (build-system gnu-build-system) | |
201 | (arguments | |
ced12a7b RW |
202 | `(#:imported-modules (,@%gnu-build-system-modules |
203 | (guix build python-build-system)) | |
204 | #:phases | |
23aab4ab RW |
205 | (modify-phases %standard-phases |
206 | (add-after 'unpack 'enter-dir | |
207 | (lambda _ (chdir "ghmm") #t)) | |
ced12a7b RW |
208 | (delete 'check) |
209 | (add-after 'install 'check | |
210 | (assoc-ref %standard-phases 'check)) | |
211 | (add-before 'check 'fix-PYTHONPATH | |
212 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
213 | (let ((python-version ((@@ (guix build python-build-system) | |
214 | get-python-version) | |
215 | (assoc-ref inputs "python")))) | |
216 | (setenv "PYTHONPATH" | |
217 | (string-append (getenv "PYTHONPATH") | |
218 | ":" (assoc-ref outputs "out") | |
219 | "/lib/python" python-version | |
220 | "/site-packages"))) | |
23aab4ab RW |
221 | #t)) |
222 | (add-after 'enter-dir 'fix-runpath | |
223 | (lambda* (#:key outputs #:allow-other-keys) | |
224 | (substitute* "ghmmwrapper/setup.py" | |
225 | (("^(.*)extra_compile_args = \\[" line indent) | |
226 | (string-append indent | |
227 | "extra_link_args = [\"-Wl,-rpath=" | |
228 | (assoc-ref outputs "out") "/lib\"],\n" | |
229 | line | |
230 | "\"-Wl,-rpath=" | |
231 | (assoc-ref outputs "out") | |
232 | "/lib\", "))) | |
233 | #t)) | |
234 | (add-after 'enter-dir 'disable-broken-tests | |
235 | (lambda _ | |
236 | (substitute* "tests/Makefile.am" | |
237 | ;; GHMM_SILENT_TESTS is assumed to be a command. | |
238 | (("TESTS_ENVIRONMENT.*") "") | |
239 | ;; Do not build broken tests. | |
240 | (("chmm .*") "") | |
241 | (("read_fa .*") "") | |
242 | (("mcmc .*") "") | |
243 | (("label_higher_order_test.*$") | |
244 | "label_higher_order_test\n")) | |
245 | ||
246 | ;; These Python unittests are broken as there is no gato. | |
247 | ;; See https://sourceforge.net/p/ghmm/support-requests/3/ | |
248 | (substitute* "ghmmwrapper/ghmmunittests.py" | |
249 | (("^(.*)def (testNewXML|testMultipleTransitionClasses|testNewXML)" | |
250 | line indent) | |
251 | (string-append indent | |
252 | "@unittest.skip(\"Disabled by Guix\")\n" | |
253 | line))) | |
a491856f | 254 | #t))))) |
23aab4ab RW |
255 | (inputs |
256 | `(("python" ,python-2) ; only Python 2 is supported | |
257 | ("libxml2" ,libxml2))) | |
258 | (native-inputs | |
259 | `(("pkg-config" ,pkg-config) | |
260 | ("dejagnu" ,dejagnu) | |
261 | ("swig" ,swig) | |
262 | ("autoconf" ,autoconf) | |
263 | ("automake" ,automake) | |
264 | ("libtool" ,libtool))) | |
265 | (home-page "http://ghmm.org") | |
266 | (synopsis "Hidden Markov Model library") | |
267 | (description | |
268 | "The General Hidden Markov Model library (GHMM) is a C library with | |
269 | additional Python bindings implementing a wide range of types of @dfn{Hidden | |
d1e4ad1b | 270 | Markov Models} (HMM) and algorithms: discrete, continuous emissions, basic |
23aab4ab RW |
271 | training, HMM clustering, HMM mixtures.") |
272 | (license license:lgpl2.0+)))) | |
273 | ||
791c11d6 BW |
274 | (define-public mcl |
275 | (package | |
276 | (name "mcl") | |
277 | (version "14.137") | |
278 | (source (origin | |
279 | (method url-fetch) | |
280 | (uri (string-append | |
281 | "http://micans.org/mcl/src/mcl-" | |
282 | (string-replace-substring version "." "-") | |
283 | ".tar.gz")) | |
284 | (sha256 | |
285 | (base32 | |
286 | "15xlax3z31lsn62vlg94hkm75nm40q4679amnfg13jm8m2bnhy5m")))) | |
287 | (build-system gnu-build-system) | |
288 | (arguments | |
289 | `(#:configure-flags (list "--enable-blast"))) | |
290 | (inputs | |
291 | `(("perl" ,perl))) | |
292 | (home-page "http://micans.org/mcl/") | |
293 | (synopsis "Clustering algorithm for graphs") | |
294 | (description | |
295 | "The MCL algorithm is short for the @dfn{Markov Cluster Algorithm}, a | |
296 | fast and scalable unsupervised cluster algorithm for graphs (also known as | |
297 | networks) based on simulation of (stochastic) flow in graphs.") | |
298 | ;; In the LICENCE file and web page it says "The software is licensed | |
299 | ;; under the GNU General Public License, version 3.", but in several of | |
300 | ;; the source code files it suggests GPL3 or later. | |
301 | ;; http://listserver.ebi.ac.uk/pipermail/mcl-users/2016/000376.html | |
302 | (license license:gpl3))) | |
303 | ||
0a3063d6 BW |
304 | (define-public ocaml-mcl |
305 | (package | |
306 | (name "ocaml-mcl") | |
307 | (version "12-068oasis4") | |
308 | (source | |
309 | (origin | |
fb168a31 RW |
310 | (method git-fetch) |
311 | (uri (git-reference | |
312 | (url "https://github.com/fhcrc/mcl.git") | |
313 | (commit version))) | |
314 | (file-name (git-file-name name version)) | |
0a3063d6 BW |
315 | (sha256 |
316 | (base32 | |
fb168a31 | 317 | "0009dc3h2jp3qg5val452wngpqnbfyhbcxylghq0mrjqxx0jdq5p")))) |
0a3063d6 BW |
318 | (build-system ocaml-build-system) |
319 | (arguments | |
b24aaeec | 320 | `(#:phases |
0a3063d6 BW |
321 | (modify-phases %standard-phases |
322 | (add-before 'configure 'patch-paths | |
323 | (lambda _ | |
324 | (substitute* "configure" | |
b24aaeec | 325 | (("/bin/sh") (which "sh"))) |
0a3063d6 BW |
326 | (substitute* "setup.ml" |
327 | (("LDFLAGS=-fPIC") | |
b24aaeec RW |
328 | (string-append "LDFLAGS=-fPIC\"; \"SHELL=" (which "sh"))) |
329 | (("-std=c89") "-std=gnu99") | |
330 | ||
331 | ;; This is a mutable string, which is no longer supported. Use | |
332 | ;; a byte buffer instead. | |
333 | (("String.make \\(String.length s\\)") | |
334 | "Bytes.make (String.length s)") | |
335 | ||
336 | ;; These two belong together. | |
337 | (("OASISString.replace_chars") | |
338 | "Bytes.to_string (OASISString.replace_chars") | |
339 | ((" s;") | |
340 | " s);")) | |
341 | (substitute* "myocamlbuild.ml" | |
342 | (("std=c89") "std=gnu99")) | |
343 | ;; Since we build with a more recent OCaml, we have to use C99 or | |
344 | ;; later. This causes problems with the old C code. | |
345 | (substitute* "src/impala/matrix.c" | |
346 | (("restrict") "restrict_")) | |
0a3063d6 | 347 | #t))))) |
b24aaeec RW |
348 | (native-inputs |
349 | `(("ocamlbuild" ,ocamlbuild))) | |
0a3063d6 BW |
350 | (home-page "https://github.com/fhcrc/mcl") |
351 | (synopsis "OCaml wrappers around MCL") | |
352 | (description | |
353 | "This package provides OCaml bindings for the MCL graph clustering | |
354 | algorithm.") | |
355 | (license license:gpl3))) | |
356 | ||
0931c609 RW |
357 | (define-public randomjungle |
358 | (package | |
359 | (name "randomjungle") | |
360 | (version "2.1.0") | |
361 | (source | |
362 | (origin | |
363 | (method url-fetch) | |
364 | (uri (string-append | |
df4c8434 BH |
365 | "https://www.imbs.uni-luebeck.de/fileadmin/files/Software" |
366 | "/randomjungle/randomjungle-" version ".tar_.gz")) | |
1e92d311 | 367 | (patches (search-patches "randomjungle-disable-static-build.patch")) |
0931c609 RW |
368 | (sha256 |
369 | (base32 | |
370 | "12c8rf30cla71swx2mf4ww9mfd8jbdw5lnxd7dxhyw1ygrvg6y4w")))) | |
371 | (build-system gnu-build-system) | |
372 | (arguments | |
373 | `(#:configure-flags | |
1e92d311 MB |
374 | (list "--disable-static" |
375 | (string-append "--with-boost=" | |
0931c609 RW |
376 | (assoc-ref %build-inputs "boost"))) |
377 | #:phases | |
378 | (modify-phases %standard-phases | |
379 | (add-before | |
380 | 'configure 'set-CXXFLAGS | |
381 | (lambda _ | |
382 | (setenv "CXXFLAGS" "-fpermissive ") | |
383 | #t))))) | |
384 | (inputs | |
385 | `(("boost" ,boost) | |
386 | ("gsl" ,gsl) | |
387 | ("libxml2" ,libxml2) | |
388 | ("zlib" ,zlib))) | |
389 | (native-inputs | |
25e0037a EF |
390 | `(("gfortran" ,gfortran) |
391 | ("gfortran:lib" ,gfortran "lib"))) | |
47818201 RW |
392 | ;; Non-portable assembly instructions are used so building fails on |
393 | ;; platforms other than x86_64 or i686. | |
394 | (supported-systems '("x86_64-linux" "i686-linux")) | |
df4c8434 | 395 | (home-page "https://www.imbs.uni-luebeck.de/forschung/software/details.html#c224") |
0931c609 RW |
396 | (synopsis "Implementation of the Random Forests machine learning method") |
397 | (description | |
398 | "Random Jungle is an implementation of Random Forests. It is supposed to | |
399 | analyse high dimensional data. In genetics, it can be used for analysing big | |
400 | Genome Wide Association (GWA) data. Random Forests is a powerful machine | |
401 | learning method. Most interesting features are variable selection, missing | |
402 | value imputation, classifier creation, generalization error estimation and | |
403 | sample proximities between pairs of cases.") | |
404 | (license license:gpl3+))) | |
c1670a81 | 405 | |
7d4cab74 RW |
406 | (define-public openfst |
407 | (package | |
408 | (name "openfst") | |
5ed72097 | 409 | (version "1.7.2") |
7d4cab74 RW |
410 | (source (origin |
411 | (method url-fetch) | |
412 | (uri (string-append "http://www.openfst.org/twiki/pub/FST/" | |
413 | "FstDownload/openfst-" version ".tar.gz")) | |
414 | (sha256 | |
415 | (base32 | |
5ed72097 | 416 | "0fqgk8195kz21is09gwzwnrg7fr9526bi9mh4apyskapz27pbhr1")))) |
7d4cab74 RW |
417 | (build-system gnu-build-system) |
418 | (home-page "http://www.openfst.org") | |
419 | (synopsis "Library for weighted finite-state transducers") | |
420 | (description "OpenFst is a library for constructing, combining, | |
421 | optimizing, and searching weighted finite-state transducers (FSTs).") | |
422 | (license license:asl2.0))) | |
423 | ||
c1670a81 RW |
424 | (define-public shogun |
425 | (package | |
426 | (name "shogun") | |
5a14e81e | 427 | (version "6.1.3") |
c1670a81 RW |
428 | (source |
429 | (origin | |
430 | (method url-fetch) | |
431 | (uri (string-append | |
432 | "ftp://shogun-toolbox.org/shogun/releases/" | |
433 | (version-major+minor version) | |
434 | "/sources/shogun-" version ".tar.bz2")) | |
435 | (sha256 | |
436 | (base32 | |
5a14e81e | 437 | "1rn9skm3nw6hr7mr3lgp2gfqhi7ii0lyxck7qmqnf8avq349s5jp")) |
c1670a81 RW |
438 | (modules '((guix build utils) |
439 | (ice-9 rdelim))) | |
440 | (snippet | |
441 | '(begin | |
442 | ;; Remove non-free sources and files referencing them | |
443 | (for-each delete-file | |
444 | (find-files "src/shogun/classifier/svm/" | |
445 | "SVMLight\\.(cpp|h)")) | |
446 | (for-each delete-file | |
447 | (find-files "examples/undocumented/libshogun/" | |
448 | (string-append | |
449 | "(classifier_.*svmlight.*|" | |
450 | "evaluation_cross_validation_locked_comparison).cpp"))) | |
451 | ;; Remove non-free functions. | |
452 | (define (delete-ifdefs file) | |
453 | (with-atomic-file-replacement file | |
454 | (lambda (in out) | |
455 | (let loop ((line (read-line in 'concat)) | |
456 | (skipping? #f)) | |
457 | (if (eof-object? line) | |
458 | #t | |
459 | (let ((skip-next? | |
460 | (or (and skipping? | |
461 | (not (string-prefix? | |
462 | "#endif //USE_SVMLIGHT" line))) | |
463 | (string-prefix? | |
464 | "#ifdef USE_SVMLIGHT" line)))) | |
465 | (when (or (not skipping?) | |
466 | (and skipping? (not skip-next?))) | |
467 | (display line out)) | |
468 | (loop (read-line in 'concat) skip-next?))))))) | |
5a14e81e KK |
469 | (for-each delete-ifdefs |
470 | (append | |
471 | (find-files "src/shogun/classifier/mkl" | |
472 | "^MKLClassification\\.cpp") | |
473 | (find-files "src/shogun/classifier/svm" | |
474 | "^SVMLightOneClass\\.(cpp|h)") | |
475 | (find-files "src/shogun/multiclass" | |
476 | "^ScatterSVM\\.(cpp|h)") | |
477 | (find-files "src/shogun/kernel/" | |
478 | "^(Kernel|CombinedKernel|ProductKernel)\\.(cpp|h)") | |
479 | (find-files "src/shogun/regression/svr" | |
480 | "^(MKLRegression|SVRLight)\\.(cpp|h)") | |
481 | (find-files "src/shogun/transfer/domain_adaptation" | |
c0d7c124 | 482 | "^DomainAdaptationSVM\\.(cpp|h)"))) |
6cbee49d | 483 | #t)))) |
c1670a81 RW |
484 | (build-system cmake-build-system) |
485 | (arguments | |
486 | '(#:tests? #f ;no check target | |
487 | #:phases | |
dc1d3cde KK |
488 | (modify-phases %standard-phases |
489 | (add-after 'unpack 'delete-broken-symlinks | |
490 | (lambda _ | |
491 | (for-each delete-file '("applications/arts/data" | |
492 | "applications/asp/data" | |
493 | "applications/easysvm/data" | |
494 | "applications/msplicer/data" | |
495 | "applications/ocr/data" | |
5a14e81e KK |
496 | "examples/meta/data" |
497 | "examples/undocumented/data")) | |
dc1d3cde KK |
498 | #t)) |
499 | (add-after 'unpack 'change-R-target-path | |
500 | (lambda* (#:key outputs #:allow-other-keys) | |
5a14e81e KK |
501 | (substitute* '("src/interfaces/r/CMakeLists.txt" |
502 | "examples/meta/r/CMakeLists.txt") | |
dc1d3cde KK |
503 | (("\\$\\{R_COMPONENT_LIB_PATH\\}") |
504 | (string-append (assoc-ref outputs "out") | |
505 | "/lib/R/library/"))) | |
506 | #t)) | |
507 | (add-after 'unpack 'fix-octave-modules | |
508 | (lambda* (#:key outputs #:allow-other-keys) | |
5a14e81e | 509 | (substitute* "src/interfaces/octave/CMakeLists.txt" |
dc1d3cde | 510 | (("^include_directories\\(\\$\\{OCTAVE_INCLUDE_DIRS\\}") |
5a14e81e KK |
511 | "include_directories(${OCTAVE_INCLUDE_DIRS} ${OCTAVE_INCLUDE_DIRS}/octave") |
512 | ;; change target directory | |
dc1d3cde KK |
513 | (("\\$\\{OCTAVE_OCT_LOCAL_API_FILE_DIR\\}") |
514 | (string-append (assoc-ref outputs "out") | |
515 | "/share/octave/packages"))) | |
5a14e81e KK |
516 | (substitute* '("src/interfaces/octave/swig_typemaps.i" |
517 | "src/interfaces/octave/sg_print_functions.cpp") | |
518 | ;; "octave/config.h" and "octave/oct-obj.h" deprecated in Octave. | |
519 | (("octave/config\\.h") "octave/octave-config.h") | |
520 | (("octave/oct-obj.h") "octave/ovl.h")) | |
dc1d3cde | 521 | #t)) |
5a14e81e KK |
522 | (add-after 'unpack 'move-rxcpp |
523 | (lambda* (#:key inputs #:allow-other-keys) | |
524 | (let ((rxcpp-dir "shogun/third-party/rxcpp")) | |
525 | (mkdir-p rxcpp-dir) | |
526 | (install-file (assoc-ref inputs "rxcpp") rxcpp-dir) | |
527 | #t))) | |
dc1d3cde | 528 | (add-before 'build 'set-HOME |
c1670a81 | 529 | ;; $HOME needs to be set at some point during the build phase |
dc1d3cde | 530 | (lambda _ (setenv "HOME" "/tmp") #t))) |
c1670a81 RW |
531 | #:configure-flags |
532 | (list "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE" | |
533 | "-DUSE_SVMLIGHT=OFF" ;disable proprietary SVMLIGHT | |
5a14e81e KK |
534 | "-DBUILD_META_EXAMPLES=OFF" ;requires unpackaged ctags |
535 | ;;"-DINTERFACE_JAVA=ON" ;requires unpackaged jblas | |
536 | ;;"-DINTERFACE_RUBY=ON" ;requires unpackaged ruby-narray | |
537 | ;;"-DINTERFACE_PERL=ON" ;"FindPerlLibs" does not exist | |
538 | ;;"-DINTERFACE_LUA=ON" ;fails because lua doesn't build pkgconfig file | |
539 | "-DINTERFACE_OCTAVE=ON" | |
540 | "-DINTERFACE_PYTHON=ON" | |
541 | "-DINTERFACE_R=ON"))) | |
c1670a81 RW |
542 | (inputs |
543 | `(("python" ,python) | |
544 | ("numpy" ,python-numpy) | |
2d7c4ae3 | 545 | ("r-minimal" ,r-minimal) |
5537603f | 546 | ("octave" ,octave-cli) |
c1670a81 | 547 | ("swig" ,swig) |
5a14e81e | 548 | ("eigen" ,eigen) |
c1670a81 RW |
549 | ("hdf5" ,hdf5) |
550 | ("atlas" ,atlas) | |
551 | ("arpack" ,arpack-ng) | |
552 | ("lapack" ,lapack) | |
553 | ("glpk" ,glpk) | |
554 | ("libxml2" ,libxml2) | |
555 | ("lzo" ,lzo) | |
556 | ("zlib" ,zlib))) | |
557 | (native-inputs | |
5a14e81e KK |
558 | `(("pkg-config" ,pkg-config) |
559 | ("rxcpp" ,rxcpp))) | |
6b5b656f RW |
560 | ;; Non-portable SSE instructions are used so building fails on platforms |
561 | ;; other than x86_64. | |
562 | (supported-systems '("x86_64-linux")) | |
c1670a81 RW |
563 | (home-page "http://shogun-toolbox.org/") |
564 | (synopsis "Machine learning toolbox") | |
565 | (description | |
566 | "The Shogun Machine learning toolbox provides a wide range of unified and | |
567 | efficient Machine Learning (ML) methods. The toolbox seamlessly allows to | |
568 | combine multiple data representations, algorithm classes, and general purpose | |
569 | tools. This enables both rapid prototyping of data pipelines and extensibility | |
570 | in terms of new algorithms.") | |
571 | (license license:gpl3+))) | |
8406138b | 572 | |
3a354e10 KK |
573 | (define-public rxcpp |
574 | (package | |
575 | (name "rxcpp") | |
e91a0bff | 576 | (version "4.1.0") |
3a354e10 KK |
577 | (source |
578 | (origin | |
5daafe0b TGR |
579 | (method git-fetch) |
580 | (uri (git-reference | |
581 | (url "https://github.com/ReactiveX/RxCpp.git") | |
582 | (commit (string-append "v" version)))) | |
3a354e10 | 583 | (sha256 |
5daafe0b TGR |
584 | (base32 "1rdpa3jlc181jd08nk437aar085h28i45s6nzrv65apb3xyyz0ij")) |
585 | (file-name (git-file-name name version)))) | |
3a354e10 KK |
586 | (build-system cmake-build-system) |
587 | (arguments | |
588 | `(#:phases | |
589 | (modify-phases %standard-phases | |
590 | (add-after 'unpack 'remove-werror | |
591 | (lambda _ | |
592 | (substitute* (find-files ".") | |
593 | (("-Werror") "")) | |
594 | #t)) | |
595 | (replace 'check | |
596 | (lambda _ | |
597 | (invoke "ctest")))))) | |
598 | (native-inputs | |
599 | `(("catch" ,catch-framework))) | |
600 | (home-page "http://reactivex.io/") | |
601 | (synopsis "Reactive Extensions for C++") | |
602 | (description | |
603 | "The Reactive Extensions for C++ (RxCpp) is a library of algorithms for | |
604 | values-distributed-in-time. ReactiveX is a library for composing asynchronous | |
605 | and event-based programs by using observable sequences. | |
606 | ||
607 | It extends the observer pattern to support sequences of data and/or events and | |
608 | adds operators that allow you to compose sequences together declaratively while | |
609 | abstracting away concerns about things like low-level threading, | |
610 | synchronization, thread-safety, concurrent data structures, and non-blocking | |
611 | I/O.") | |
612 | (license license:asl2.0))) | |
613 | ||
8406138b RW |
614 | (define-public r-adaptivesparsity |
615 | (package | |
616 | (name "r-adaptivesparsity") | |
c0608f81 | 617 | (version "1.6") |
8406138b RW |
618 | (source (origin |
619 | (method url-fetch) | |
620 | (uri (cran-uri "AdaptiveSparsity" version)) | |
621 | (sha256 | |
622 | (base32 | |
c0608f81 | 623 | "0imr5m8mll9j6n4icsv6z9rl5kbnwsp9wvzrg7n90nnmcxq2cz91")))) |
8406138b RW |
624 | (properties |
625 | `((upstream-name . "AdaptiveSparsity"))) | |
626 | (build-system r-build-system) | |
627 | (arguments | |
628 | `(#:phases | |
629 | (modify-phases %standard-phases | |
630 | (add-after 'unpack 'link-against-armadillo | |
631 | (lambda _ | |
632 | (substitute* "src/Makevars" | |
633 | (("PKG_LIBS=" prefix) | |
634 | (string-append prefix "-larmadillo")))))))) | |
635 | (propagated-inputs | |
c0608f81 RW |
636 | `(("r-mass" ,r-mass) |
637 | ("r-matrix" ,r-matrix) | |
638 | ("r-rcpp" ,r-rcpp) | |
8406138b | 639 | ("r-rcpparmadillo" ,r-rcpparmadillo))) |
60e36bff LC |
640 | (inputs |
641 | `(("armadillo" ,armadillo))) | |
e9960d8c | 642 | (home-page "https://cran.r-project.org/web/packages/AdaptiveSparsity") |
8406138b RW |
643 | (synopsis "Adaptive sparsity models") |
644 | (description | |
645 | "This package implements the Figueiredo machine learning algorithm for | |
646 | adaptive sparsity and the Wong algorithm for adaptively sparse gaussian | |
647 | geometric models.") | |
648 | (license license:lgpl3+))) | |
e4785eb8 | 649 | |
39bb4937 RW |
650 | (define-public gemmlowp-for-tensorflow |
651 | ;; The commit hash is taken from "tensorflow/workspace.bzl". | |
652 | (let ((commit "38ebac7b059e84692f53e5938f97a9943c120d98") | |
653 | (revision "2")) | |
654 | (package | |
655 | (name "gemmlowp") | |
656 | (version (git-version "0" revision commit)) | |
657 | (source (origin | |
658 | (method url-fetch) | |
659 | (uri (string-append "https://mirror.bazel.build/" | |
660 | "github.com/google/gemmlowp/archive/" | |
661 | commit ".zip")) | |
662 | (file-name (string-append "gemmlowp-" version ".zip")) | |
663 | (sha256 | |
664 | (base32 | |
665 | "0n56s2g8hrssm4w8qj1v58gfm56a04n9v992ixkmvk6zjiralzxq")))) | |
666 | (build-system cmake-build-system) | |
667 | (arguments | |
668 | `(#:configure-flags | |
669 | (list ,@(match (%current-system) | |
670 | ((or "x86_64-linux" "i686-linux") | |
a32e3b90 | 671 | '("-DCMAKE_CXX_FLAGS=-msse2")) |
39bb4937 RW |
672 | (_ '()))) |
673 | #:phases | |
674 | (modify-phases %standard-phases | |
675 | ;; This directory contains the CMakeLists.txt. | |
676 | (add-after 'unpack 'chdir | |
677 | (lambda _ (chdir "contrib") #t)) | |
678 | ;; There is no install target | |
679 | (replace 'install | |
680 | (lambda* (#:key outputs #:allow-other-keys) | |
681 | (let* ((out (assoc-ref outputs "out")) | |
682 | (lib (string-append out "/lib/")) | |
683 | (inc (string-append out "/include/"))) | |
684 | (install-file "../build/libeight_bit_int_gemm.so" lib) | |
685 | (for-each (lambda (dir) | |
686 | (let ((target (string-append inc "/" dir))) | |
687 | (mkdir-p target) | |
688 | (for-each (lambda (h) | |
689 | (install-file h target)) | |
690 | (find-files (string-append "../" dir) | |
691 | "\\.h$")))) | |
692 | '("meta" "profiling" "public" "fixedpoint" | |
693 | "eight_bit_int_gemm" "internal")) | |
694 | #t)))))) | |
695 | (native-inputs | |
696 | `(("unzip" ,unzip))) | |
697 | (home-page "https://github.com/google/gemmlowp") | |
698 | (synopsis "Small self-contained low-precision GEMM library") | |
699 | (description | |
700 | "This is a small self-contained low-precision @dfn{general matrix | |
701 | multiplication} (GEMM) library. It is not a full linear algebra library. | |
702 | Low-precision means that the input and output matrix entries are integers on | |
703 | at most 8 bits. To avoid overflow, results are internally accumulated on more | |
704 | than 8 bits, and at the end only some significant 8 bits are kept.") | |
705 | (license license:asl2.0)))) | |
706 | ||
5f0ff6a9 MB |
707 | (define-public dlib |
708 | (package | |
709 | (name "dlib") | |
abe97a58 | 710 | (version "19.7") |
5f0ff6a9 MB |
711 | (source (origin |
712 | (method url-fetch) | |
713 | (uri (string-append | |
714 | "http://dlib.net/files/dlib-" version ".tar.bz2")) | |
715 | (sha256 | |
716 | (base32 | |
abe97a58 | 717 | "1mljz02kwkrbggyncxv5fpnyjdybw2qihaacb3js8yfkw12vwpc2")) |
5f0ff6a9 MB |
718 | (modules '((guix build utils))) |
719 | (snippet | |
720 | '(begin | |
721 | ;; Delete ~13MB of bundled dependencies. | |
722 | (delete-file-recursively "dlib/external") | |
0ef7ea66 MB |
723 | (delete-file-recursively "docs/dlib/external") |
724 | #t)))) | |
5f0ff6a9 MB |
725 | (build-system cmake-build-system) |
726 | (arguments | |
677bc34d | 727 | `(#:phases |
5f0ff6a9 MB |
728 | (modify-phases %standard-phases |
729 | (add-after 'unpack 'disable-asserts | |
730 | (lambda _ | |
731 | ;; config.h recommends explicitly enabling or disabling asserts | |
732 | ;; when building as a shared library. By default neither is set. | |
733 | (substitute* "dlib/config.h" | |
734 | (("^//#define DLIB_DISABLE_ASSERTS") "#define DLIB_DISABLE_ASSERTS")) | |
735 | #t)) | |
4fba38db MB |
736 | (add-after 'disable-asserts 'disable-failing-tests |
737 | (lambda _ | |
738 | ;; One test times out on MIPS, so we need to disable it. | |
0ef7ea66 | 739 | ;; Others are flaky on some platforms. |
4fba38db MB |
740 | (let* ((system ,(or (%current-target-system) |
741 | (%current-system))) | |
742 | (disabled-tests (cond | |
743 | ((string-prefix? "mips64" system) | |
744 | '("object_detector" ; timeout | |
745 | "data_io")) | |
746 | ((string-prefix? "armhf" system) | |
a343c461 | 747 | '("learning_to_track")) |
4fba38db | 748 | ((string-prefix? "i686" system) |
0ef7ea66 | 749 | '("optimization")) |
4fba38db | 750 | (else '())))) |
4fba38db MB |
751 | (for-each |
752 | (lambda (test) | |
753 | (substitute* "dlib/test/makefile" | |
0ef7ea66 MB |
754 | (((string-append "SRC \\+= " test "\\.cpp")) ""))) |
755 | disabled-tests) | |
756 | #t))) | |
5f0ff6a9 MB |
757 | (replace 'check |
758 | (lambda _ | |
759 | ;; No test target, so we build and run the unit tests here. | |
8eaf53e3 | 760 | (let ((test-dir (string-append "../dlib-" ,version "/dlib/test"))) |
5f0ff6a9 | 761 | (with-directory-excursion test-dir |
8448e6bf TGR |
762 | (invoke "make" "-j" (number->string (parallel-job-count))) |
763 | (invoke "./dtest" "--runall")) | |
764 | #t))) | |
5f0ff6a9 MB |
765 | (add-after 'install 'delete-static-library |
766 | (lambda* (#:key outputs #:allow-other-keys) | |
0ef7ea66 MB |
767 | (delete-file (string-append (assoc-ref outputs "out") |
768 | "/lib/libdlib.a")) | |
769 | #t))))) | |
5f0ff6a9 | 770 | (native-inputs |
3929f46c TGR |
771 | `(("pkg-config" ,pkg-config) |
772 | ;; For tests. | |
773 | ("libnsl" ,libnsl))) | |
5f0ff6a9 | 774 | (inputs |
f40841e9 | 775 | `(("giflib" ,giflib) |
4fba38db | 776 | ("lapack" ,lapack) |
5f0ff6a9 MB |
777 | ("libjpeg" ,libjpeg) |
778 | ("libpng" ,libpng) | |
779 | ("libx11" ,libx11) | |
780 | ("openblas" ,openblas) | |
781 | ("zlib" ,zlib))) | |
782 | (synopsis | |
783 | "Toolkit for making machine learning and data analysis applications in C++") | |
784 | (description | |
785 | "Dlib is a modern C++ toolkit containing machine learning algorithms and | |
786 | tools. It is used in both industry and academia in a wide range of domains | |
787 | including robotics, embedded devices, mobile phones, and large high performance | |
788 | computing environments.") | |
789 | (home-page "http://dlib.net") | |
790 | (license license:boost1.0))) | |
be6eb2f1 RW |
791 | |
792 | (define-public python-scikit-learn | |
793 | (package | |
794 | (name "python-scikit-learn") | |
27d6d24e | 795 | (version "0.20.3") |
be6eb2f1 RW |
796 | (source |
797 | (origin | |
4a89bdd1 RW |
798 | (method git-fetch) |
799 | (uri (git-reference | |
800 | (url "https://github.com/scikit-learn/scikit-learn.git") | |
801 | (commit version))) | |
802 | (file-name (git-file-name name version)) | |
be6eb2f1 RW |
803 | (sha256 |
804 | (base32 | |
27d6d24e | 805 | "08aaby5zphfxy83mggg35bwyka7wk91l2qijh8kk0bl08dikq8dl")))) |
be6eb2f1 RW |
806 | (build-system python-build-system) |
807 | (arguments | |
808 | `(#:phases | |
809 | (modify-phases %standard-phases | |
4a89bdd1 RW |
810 | (add-after 'build 'build-ext |
811 | (lambda _ (invoke "python" "setup.py" "build_ext" "--inplace") #t)) | |
812 | (replace 'check | |
813 | (lambda _ | |
814 | ;; Restrict OpenBLAS threads to prevent segfaults while testing! | |
815 | (setenv "OPENBLAS_NUM_THREADS" "1") | |
7ff3f3d2 MB |
816 | |
817 | ;; Some tests require write access to $HOME. | |
818 | (setenv "HOME" "/tmp") | |
819 | ||
820 | (invoke "pytest" "sklearn" "-m" "not network"))) | |
71804546 BL |
821 | (add-before 'reset-gzip-timestamps 'make-files-writable |
822 | (lambda* (#:key outputs #:allow-other-keys) | |
823 | ;; Make sure .gz files are writable so that the | |
824 | ;; 'reset-gzip-timestamps' phase can do its work. | |
825 | (let ((out (assoc-ref outputs "out"))) | |
826 | (for-each make-file-writable | |
827 | (find-files out "\\.gz$")) | |
828 | #t)))))) | |
be6eb2f1 RW |
829 | (inputs |
830 | `(("openblas" ,openblas))) | |
831 | (native-inputs | |
4a89bdd1 RW |
832 | `(("python-pytest" ,python-pytest) |
833 | ("python-pandas" ,python-pandas) ;for tests | |
be6eb2f1 RW |
834 | ("python-cython" ,python-cython))) |
835 | (propagated-inputs | |
836 | `(("python-numpy" ,python-numpy) | |
837 | ("python-scipy" ,python-scipy))) | |
838 | (home-page "http://scikit-learn.org/") | |
839 | (synopsis "Machine Learning in Python") | |
840 | (description | |
4a89bdd1 RW |
841 | "Scikit-learn provides simple and efficient tools for data mining and |
842 | data analysis.") | |
be6eb2f1 RW |
843 | (license license:bsd-3))) |
844 | ||
845 | (define-public python2-scikit-learn | |
7ff3f3d2 | 846 | (package-with-python2 python-scikit-learn)) |
2dab4188 FT |
847 | |
848 | (define-public python-autograd | |
849 | (let* ((commit "442205dfefe407beffb33550846434baa90c4de7") | |
850 | (revision "0") | |
851 | (version (git-version "0.0.0" revision commit))) | |
852 | (package | |
853 | (name "python-autograd") | |
854 | (home-page "https://github.com/HIPS/autograd") | |
855 | (source (origin | |
856 | (method git-fetch) | |
857 | (uri (git-reference | |
858 | (url home-page) | |
859 | (commit commit))) | |
860 | (sha256 | |
861 | (base32 | |
862 | "189sv2xb0mwnjawa9z7mrgdglc1miaq93pnck26r28fi1jdwg0z4")) | |
863 | (file-name (git-file-name name version)))) | |
864 | (version version) | |
865 | (build-system python-build-system) | |
866 | (native-inputs | |
867 | `(("python-nose" ,python-nose) | |
868 | ("python-pytest" ,python-pytest))) | |
869 | (propagated-inputs | |
870 | `(("python-future" ,python-future) | |
871 | ("python-numpy" ,python-numpy))) | |
872 | (arguments | |
873 | `(#:phases (modify-phases %standard-phases | |
874 | (replace 'check | |
875 | (lambda _ | |
876 | (invoke "py.test" "-v")))))) | |
877 | (synopsis "Efficiently computes derivatives of NumPy code") | |
878 | (description "Autograd can automatically differentiate native Python and | |
879 | NumPy code. It can handle a large subset of Python's features, including loops, | |
880 | ifs, recursion and closures, and it can even take derivatives of derivatives | |
881 | of derivatives. It supports reverse-mode differentiation | |
882 | (a.k.a. backpropagation), which means it can efficiently take gradients of | |
883 | scalar-valued functions with respect to array-valued arguments, as well as | |
884 | forward-mode differentiation, and the two can be composed arbitrarily. The | |
885 | main intended application of Autograd is gradient-based optimization.") | |
886 | (license license:expat)))) | |
887 | ||
888 | (define-public python2-autograd | |
889 | (package-with-python2 python-autograd)) | |
112c2c01 FT |
890 | |
891 | (define-public lightgbm | |
892 | (package | |
893 | (name "lightgbm") | |
894 | (version "2.0.12") | |
895 | (source (origin | |
896 | (method url-fetch) | |
897 | (uri (string-append | |
898 | "https://github.com/Microsoft/LightGBM/archive/v" | |
899 | version ".tar.gz")) | |
900 | (sha256 | |
901 | (base32 | |
902 | "132zf0yk0545mg72hyzxm102g3hpb6ixx9hnf8zd2k55gas6cjj1")) | |
903 | (file-name (string-append name "-" version ".tar.gz")))) | |
904 | (native-inputs | |
905 | `(("python-pytest" ,python-pytest) | |
906 | ("python-nose" ,python-nose))) | |
907 | (inputs | |
908 | `(("openmpi" ,openmpi))) | |
909 | (propagated-inputs | |
910 | `(("python-numpy" ,python-numpy) | |
911 | ("python-scipy" ,python-scipy))) | |
912 | (arguments | |
913 | `(#:configure-flags | |
914 | '("-DUSE_MPI=ON") | |
915 | #:phases | |
916 | (modify-phases %standard-phases | |
917 | (replace 'check | |
918 | (lambda* (#:key outputs #:allow-other-keys) | |
919 | (with-directory-excursion ,(string-append "../LightGBM-" version) | |
920 | (invoke "pytest" "tests/c_api_test/test_.py"))))))) | |
921 | (build-system cmake-build-system) | |
922 | (home-page "https://github.com/Microsoft/LightGBM") | |
923 | (synopsis "Gradient boosting framework based on decision tree algorithms") | |
924 | (description "LightGBM is a gradient boosting framework that uses tree | |
925 | based learning algorithms. It is designed to be distributed and efficient with | |
926 | the following advantages: | |
927 | ||
928 | @itemize | |
929 | @item Faster training speed and higher efficiency | |
930 | @item Lower memory usage | |
931 | @item Better accuracy | |
932 | @item Parallel and GPU learning supported (not enabled in this package) | |
933 | @item Capable of handling large-scale data | |
934 | @end itemize\n") | |
935 | (license license:expat))) | |
a8fb82a8 FT |
936 | |
937 | (define-public vowpal-wabbit | |
938 | ;; Language bindings not included. | |
939 | (package | |
940 | (name "vowpal-wabbit") | |
941 | (version "8.5.0") | |
942 | (source (origin | |
943 | (method url-fetch) | |
944 | (uri (string-append | |
945 | "https://github.com/JohnLangford/vowpal_wabbit/archive/" | |
946 | version ".tar.gz")) | |
947 | (sha256 | |
948 | (base32 | |
949 | "0clp2kb7rk5sckhllxjr5a651awf4s8dgzg4659yh4hf5cqnf0gr")) | |
950 | (file-name (string-append name "-" version ".tar.gz")))) | |
951 | (inputs | |
952 | `(("boost" ,boost) | |
953 | ("zlib" ,zlib))) | |
954 | (arguments | |
955 | `(#:configure-flags | |
956 | (list (string-append "--with-boost=" | |
957 | (assoc-ref %build-inputs "boost"))))) | |
958 | (build-system gnu-build-system) | |
959 | (home-page "https://github.com/JohnLangford/vowpal_wabbit") | |
960 | (synopsis "Fast machine learning library for online learning") | |
961 | (description "Vowpal Wabbit is a machine learning system with techniques | |
962 | such as online, hashing, allreduce, reductions, learning2search, active, and | |
963 | interactive learning.") | |
964 | (license license:bsd-3))) | |
915c6bf6 LC |
965 | |
966 | (define-public python2-fastlmm | |
967 | (package | |
968 | (name "python2-fastlmm") | |
969 | (version "0.2.21") | |
970 | (source | |
971 | (origin | |
972 | (method url-fetch) | |
973 | (uri (pypi-uri "fastlmm" version ".zip")) | |
974 | (sha256 | |
975 | (base32 | |
976 | "1q8c34rpmwkfy3r4d5172pzdkpfryj561897z9r3x22gq7813x1m")))) | |
977 | (build-system python-build-system) | |
978 | (arguments | |
237ee6f2 RW |
979 | `(#:tests? #f ; some test files are missing |
980 | #:python ,python-2)) ; only Python 2.7 is supported | |
915c6bf6 LC |
981 | (propagated-inputs |
982 | `(("python2-numpy" ,python2-numpy) | |
983 | ("python2-scipy" ,python2-scipy) | |
984 | ("python2-matplotlib" ,python2-matplotlib) | |
985 | ("python2-pandas" ,python2-pandas) | |
986 | ("python2-scikit-learn" ,python2-scikit-learn) | |
987 | ("python2-pysnptools" ,python2-pysnptools))) | |
988 | (native-inputs | |
989 | `(("unzip" ,unzip) | |
990 | ("python2-cython" ,python2-cython) | |
991 | ("python2-mock" ,python2-mock) | |
992 | ("python2-nose" ,python2-nose))) | |
993 | (home-page "http://research.microsoft.com/en-us/um/redmond/projects/mscompbio/fastlmm/") | |
994 | (synopsis "Perform genome-wide association studies on large data sets") | |
995 | (description | |
996 | "FaST-LMM, which stands for Factored Spectrally Transformed Linear Mixed | |
997 | Models, is a program for performing both single-SNP and SNP-set genome-wide | |
998 | association studies (GWAS) on extremely large data sets.") | |
999 | (license license:asl2.0))) | |
b9445d0b RW |
1000 | |
1001 | ;; There have been no proper releases yet. | |
1002 | (define-public kaldi | |
1003 | (let ((commit "2f95609f0bb085bd3a1dc5eb0a39f3edea59e606") | |
1004 | (revision "1")) | |
1005 | (package | |
1006 | (name "kaldi") | |
1007 | (version (git-version "0" revision commit)) | |
1008 | (source (origin | |
1009 | (method git-fetch) | |
1010 | (uri (git-reference | |
1011 | (url "https://github.com/kaldi-asr/kaldi.git") | |
1012 | (commit commit))) | |
1013 | (file-name (git-file-name name version)) | |
1014 | (sha256 | |
1015 | (base32 | |
1016 | "082qh3pfi7hvncylp4xsmkfahbd7gb0whdfa4rwrx7fxk9rdh3kz")))) | |
1017 | (build-system gnu-build-system) | |
1018 | (arguments | |
1019 | `(#:test-target "test" | |
1020 | #:phases | |
1021 | (modify-phases %standard-phases | |
1022 | (add-after 'unpack 'chdir | |
1023 | (lambda _ (chdir "src") #t)) | |
1024 | (replace 'configure | |
1025 | (lambda* (#:key build system inputs outputs #:allow-other-keys) | |
1026 | (when (not (or (string-prefix? "x86_64" system) | |
1027 | (string-prefix? "i686" system))) | |
1028 | (substitute* "makefiles/linux_openblas.mk" | |
1029 | (("-msse -msse2") ""))) | |
1030 | (substitute* "makefiles/default_rules.mk" | |
1031 | (("/bin/bash") (which "bash"))) | |
1032 | (substitute* "Makefile" | |
1033 | (("ext_depend: check_portaudio") | |
1034 | "ext_depend:")) | |
1035 | (substitute* '("online/Makefile" | |
1036 | "onlinebin/Makefile" | |
1037 | "gst-plugin/Makefile") | |
1038 | (("../../tools/portaudio/install") | |
1039 | (assoc-ref inputs "portaudio"))) | |
1040 | ||
1041 | ;; This `configure' script doesn't support variables passed as | |
1042 | ;; arguments, nor does it support "prefix". | |
1043 | (let ((out (assoc-ref outputs "out")) | |
1044 | (openblas (assoc-ref inputs "openblas")) | |
1045 | (openfst (assoc-ref inputs "openfst"))) | |
1046 | (substitute* "configure" | |
1047 | (("check_for_slow_expf;") "") | |
1048 | ;; This affects the RPATH and also serves as the installation | |
1049 | ;; directory. | |
1050 | (("KALDILIBDIR=`pwd`/lib") | |
1051 | (string-append "KALDILIBDIR=" out "/lib"))) | |
1052 | (mkdir-p out) ; must exist | |
1053 | (setenv "CONFIG_SHELL" (which "bash")) | |
1054 | (setenv "OPENFST_VER" ,(package-version openfst)) | |
1055 | (invoke "./configure" | |
1056 | "--use-cuda=no" | |
1057 | "--shared" | |
1058 | (string-append "--openblas-root=" openblas) | |
1059 | (string-append "--fst-root=" openfst))))) | |
1060 | (add-after 'build 'build-ext-and-gstreamer-plugin | |
1061 | (lambda _ | |
1062 | (invoke "make" "-C" "online" "depend") | |
1063 | (invoke "make" "-C" "online") | |
1064 | (invoke "make" "-C" "onlinebin" "depend") | |
1065 | (invoke "make" "-C" "onlinebin") | |
1066 | (invoke "make" "-C" "gst-plugin" "depend") | |
1067 | (invoke "make" "-C" "gst-plugin") | |
1068 | #t)) | |
1069 | ;; TODO: also install the executables. | |
1070 | (replace 'install | |
1071 | (lambda* (#:key outputs #:allow-other-keys) | |
1072 | (let* ((out (assoc-ref outputs "out")) | |
1fdd20c7 | 1073 | (inc (string-append out "/include")) |
b9445d0b RW |
1074 | (lib (string-append out "/lib"))) |
1075 | (mkdir-p lib) | |
1fdd20c7 RW |
1076 | ;; The build phase installed symlinks to the actual |
1077 | ;; libraries. Install the actual targets. | |
1078 | (for-each (lambda (file) | |
1079 | (let ((target (readlink file))) | |
1080 | (delete-file file) | |
1081 | (install-file target lib))) | |
1082 | (find-files lib "\\.so")) | |
1083 | ;; Install headers | |
1084 | (for-each (lambda (file) | |
1085 | (let ((target-dir (string-append inc "/" (dirname file)))) | |
1086 | (install-file file target-dir))) | |
1087 | (find-files "." "\\.h")) | |
1088 | (install-file "gst-plugin/libgstonlinegmmdecodefaster.so" | |
1089 | (string-append lib "/gstreamer-1.0")) | |
b9445d0b RW |
1090 | #t)))))) |
1091 | (inputs | |
1092 | `(("alsa-lib" ,alsa-lib) | |
1093 | ("gfortran" ,gfortran "lib") | |
1094 | ("glib" ,glib) | |
1095 | ("gstreamer" ,gstreamer) | |
1096 | ("jack" ,jack-1) | |
1097 | ("openblas" ,openblas) | |
1098 | ("openfst" ,openfst) | |
1099 | ("portaudio" ,portaudio) | |
1100 | ("python" ,python))) | |
1101 | (native-inputs | |
1102 | `(("glib" ,glib "bin") ; glib-genmarshal | |
1103 | ("grep" ,grep) | |
1104 | ("sed" ,sed) | |
1105 | ("pkg-config" ,pkg-config) | |
1106 | ("which" ,which))) | |
1107 | (home-page "https://kaldi-asr.org/") | |
1108 | (synopsis "Speech recognition toolkit") | |
1109 | (description "Kaldi is an extensible toolkit for speech recognition | |
1110 | written in C++.") | |
1111 | (license license:asl2.0)))) | |
99260014 RW |
1112 | |
1113 | (define-public gst-kaldi-nnet2-online | |
1114 | (let ((commit "617e43e73c7cc45eb9119028c02bd4178f738c4a") | |
1115 | (revision "1")) | |
1116 | (package | |
1117 | (name "gst-kaldi-nnet2-online") | |
1118 | (version (git-version "0" revision commit)) | |
1119 | (source (origin | |
1120 | (method git-fetch) | |
1121 | (uri (git-reference | |
1122 | (url "https://github.com/alumae/gst-kaldi-nnet2-online.git") | |
1123 | (commit commit))) | |
1124 | (file-name (git-file-name name version)) | |
1125 | (sha256 | |
1126 | (base32 | |
1127 | "0xh3w67b69818s6ib02ara4lw7wamjdmh4jznvkpzrs4skbs9jx9")))) | |
1128 | (build-system gnu-build-system) | |
1129 | (arguments | |
1130 | `(#:tests? #f ; there are none | |
1131 | #:make-flags | |
1132 | (list (string-append "SHELL=" | |
1133 | (assoc-ref %build-inputs "bash") "/bin/bash") | |
1134 | (string-append "KALDI_ROOT=" | |
1135 | (assoc-ref %build-inputs "kaldi-src")) | |
1136 | (string-append "KALDILIBDIR=" | |
1137 | (assoc-ref %build-inputs "kaldi") "/lib") | |
1138 | "KALDI_FLAVOR=dynamic") | |
1139 | #:phases | |
1140 | (modify-phases %standard-phases | |
1141 | (add-after 'unpack 'chdir | |
1142 | (lambda _ (chdir "src") #t)) | |
1143 | (replace 'configure | |
1144 | (lambda* (#:key inputs #:allow-other-keys) | |
1145 | (let ((glib (assoc-ref inputs "glib"))) | |
1146 | (setenv "CXXFLAGS" "-std=c++11 -fPIC") | |
1147 | (setenv "CPLUS_INCLUDE_PATH" | |
1148 | (string-append glib "/include/glib-2.0:" | |
1149 | glib "/lib/glib-2.0/include:" | |
1150 | (assoc-ref inputs "gstreamer") | |
1151 | "/include/gstreamer-1.0:" | |
1152 | (getenv "CPLUS_INCLUDE_PATH")))) | |
1153 | (substitute* "Makefile" | |
1154 | (("include \\$\\(KALDI_ROOT\\)/src/kaldi.mk") "") | |
1155 | (("\\$\\(error Cannot find") "#")))) | |
1156 | (add-before 'build 'build-depend | |
1157 | (lambda* (#:key make-flags #:allow-other-keys) | |
1158 | (apply invoke "make" "depend" make-flags))) | |
1159 | (replace 'install | |
1160 | (lambda* (#:key outputs #:allow-other-keys) | |
1161 | (let* ((out (assoc-ref outputs "out")) | |
1162 | (lib (string-append out "/lib/gstreamer-1.0"))) | |
1163 | (install-file "libgstkaldinnet2onlinedecoder.so" lib) | |
1164 | #t)))))) | |
1165 | (inputs | |
1166 | `(("glib" ,glib) | |
1167 | ("gstreamer" ,gstreamer) | |
1168 | ("jansson" ,jansson) | |
1169 | ("openfst" ,openfst) | |
1170 | ("kaldi" ,kaldi))) | |
1171 | (native-inputs | |
1172 | `(("bash" ,bash) | |
1173 | ("glib:bin" ,glib "bin") ; glib-genmarshal | |
1174 | ("kaldi-src" ,(package-source kaldi)) | |
1175 | ("pkg-config" ,pkg-config))) | |
1176 | (home-page "https://kaldi-asr.org/") | |
1177 | (synopsis "Gstreamer plugin for decoding speech") | |
1178 | (description "This package provides a GStreamer plugin that wraps | |
1179 | Kaldi's @code{SingleUtteranceNnet2Decoder}. It requires iVector-adapted DNN | |
1180 | acoustic models. The iVectors are adapted to the current audio stream | |
1181 | automatically.") | |
1182 | (license license:asl2.0)))) | |
10451f6b RW |
1183 | |
1184 | (define-public kaldi-gstreamer-server | |
1185 | (let ((commit "1735ba49c5dc0ebfc184e45105fc600cd9f1f508") | |
1186 | (revision "1")) | |
1187 | (package | |
1188 | (name "kaldi-gstreamer-server") | |
1189 | (version (git-version "0" revision commit)) | |
1190 | (source (origin | |
1191 | (method git-fetch) | |
1192 | (uri (git-reference | |
1193 | (url "https://github.com/alumae/kaldi-gstreamer-server.git") | |
1194 | (commit commit))) | |
1195 | (file-name (git-file-name name version)) | |
1196 | (sha256 | |
1197 | (base32 | |
1198 | "0j701m7lbwmzqxsfanj882v7881hrbmpqybbczbxqpcbg8q34w0k")))) | |
1199 | (build-system gnu-build-system) | |
1200 | (arguments | |
1201 | `(#:tests? #f ; there are no tests that can be run automatically | |
1202 | #:modules ((guix build utils) | |
1203 | (guix build gnu-build-system) | |
1204 | (srfi srfi-26)) | |
1205 | #:phases | |
1206 | (modify-phases %standard-phases | |
1207 | (delete 'configure) | |
1208 | (replace 'build | |
1209 | (lambda* (#:key outputs #:allow-other-keys) | |
1210 | ;; Disable hash randomization to ensure the generated .pycs | |
1211 | ;; are reproducible. | |
1212 | (setenv "PYTHONHASHSEED" "0") | |
1213 | (with-directory-excursion "kaldigstserver" | |
1214 | (for-each (lambda (file) | |
1215 | (apply invoke | |
1216 | `("python" | |
1217 | "-m" "compileall" | |
1218 | "-f" ; force rebuild | |
1219 | ,file))) | |
1220 | (find-files "." "\\.py$"))) | |
1221 | #t)) | |
1222 | (replace 'install | |
1223 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
1224 | (let* ((out (assoc-ref outputs "out")) | |
1225 | (bin (string-append out "/bin")) | |
1226 | (share (string-append out "/share/kaldi-gstreamer-server/"))) | |
1227 | ;; Install Python files | |
1228 | (with-directory-excursion "kaldigstserver" | |
1229 | (for-each (cut install-file <> share) | |
1230 | (find-files "." ".*"))) | |
1231 | ||
1232 | ;; Install sample configuration files | |
1233 | (for-each (cut install-file <> share) | |
1234 | (find-files "." "\\.yaml")) | |
1235 | ||
1236 | ;; Install executables | |
1237 | (mkdir-p bin) | |
1238 | (let* ((server (string-append bin "/kaldi-gst-server")) | |
1239 | (client (string-append bin "/kaldi-gst-client")) | |
1240 | (worker (string-append bin "/kaldi-gst-worker")) | |
1241 | (PYTHONPATH (getenv "PYTHONPATH")) | |
1242 | (GST_PLUGIN_PATH (string-append | |
1243 | (assoc-ref inputs "gst-kaldi-nnet2-online") | |
1244 | "/lib/gstreamer-1.0:${GST_PLUGIN_PATH}")) | |
1245 | (wrap (lambda (wrapper what) | |
1246 | (with-output-to-file wrapper | |
1247 | (lambda _ | |
1248 | (format #t | |
1249 | "#!~a | |
1250 | export PYTHONPATH=~a | |
1251 | export GST_PLUGIN_PATH=~a | |
1252 | exec ~a ~a/~a \"$@\"~%" | |
1253 | (which "bash") PYTHONPATH GST_PLUGIN_PATH | |
1254 | (which "python") share what))) | |
1255 | (chmod wrapper #o555)))) | |
1256 | (for-each wrap | |
1257 | (list server client worker) | |
1258 | (list "master_server.py" | |
1259 | "client.py" | |
1260 | "worker.py"))) | |
1261 | #t)))))) | |
1262 | (inputs | |
1263 | `(("gst-kaldi-nnet2-online" ,gst-kaldi-nnet2-online) | |
1264 | ("python2" ,python-2) | |
1265 | ("python2-futures" ,python2-futures) | |
1266 | ("python2-pygobject" ,python2-pygobject) | |
1267 | ("python2-pyyaml" ,python2-pyyaml) | |
1268 | ("python2-tornado" ,python2-tornado) | |
1269 | ("python2-ws4py" ,python2-ws4py-for-kaldi-gstreamer-server))) | |
1270 | (home-page "https://github.com/alumae/kaldi-gstreamer-server") | |
1271 | (synopsis "Real-time full-duplex speech recognition server") | |
1272 | (description "This is a real-time full-duplex speech recognition server, | |
1273 | based on the Kaldi toolkit and the GStreamer framework and implemented in | |
1274 | Python.") | |
1275 | (license license:bsd-2)))) | |
0dfeb285 RW |
1276 | |
1277 | (define-public grpc | |
1278 | (package | |
1279 | (name "grpc") | |
1280 | (version "1.16.1") | |
1281 | (source (origin | |
1282 | (method git-fetch) | |
1283 | (uri (git-reference | |
1284 | (url "https://github.com/grpc/grpc.git") | |
1285 | (commit (string-append "v" version)))) | |
1286 | (file-name (git-file-name name version)) | |
1287 | (sha256 | |
1288 | (base32 | |
1289 | "1jimqz3115f9pli5w6ik9wi7mjc7ix6y7yrq4a1ab9fc3dalj7p2")))) | |
1290 | (build-system cmake-build-system) | |
1291 | (arguments | |
1292 | `(#:tests? #f ; no test target | |
1293 | #:configure-flags | |
1294 | (list "-DgRPC_ZLIB_PROVIDER=package" | |
1295 | "-DgRPC_CARES_PROVIDER=package" | |
1296 | "-DgRPC_SSL_PROVIDER=package" | |
1297 | "-DgRPC_PROTOBUF_PROVIDER=package"))) | |
1298 | (inputs | |
1299 | `(("c-ares" ,c-ares-next) | |
1300 | ("openssl" ,openssl) | |
1301 | ("zlib" ,zlib))) | |
1302 | (native-inputs | |
1303 | `(("protobuf" ,protobuf-next) | |
1304 | ("python" ,python-wrapper))) | |
1305 | (home-page "https://grpc.io") | |
1306 | (synopsis "High performance universal RPC framework") | |
1307 | (description "gRPC is a modern open source high performance @dfn{Remote | |
1308 | Procedure Call} (RPC) framework that can run in any environment. It can | |
1309 | efficiently connect services in and across data centers with pluggable support | |
1310 | for load balancing, tracing, health checking and authentication. It is also | |
1311 | applicable in last mile of distributed computing to connect devices, mobile | |
1312 | applications and browsers to backend services.") | |
1313 | (license license:asl2.0))) | |
4fa16c9a RW |
1314 | |
1315 | ;; Note that Tensorflow includes a "third_party" directory, which seems to not | |
1316 | ;; only contain modified subsets of upstream library source code, but also | |
1317 | ;; adapter headers provided by Google (such as the fft.h header, which is not | |
1318 | ;; part of the upstream project code). The Tensorflow code includes headers | |
1319 | ;; from the "third_party" directory. It does not look like we can replace | |
1320 | ;; these headers with unmodified upstream files, so we keep them. | |
1321 | (define-public tensorflow | |
1322 | (package | |
1323 | (name "tensorflow") | |
1324 | (version "1.9.0") | |
1325 | (source | |
1326 | (origin | |
1327 | (method git-fetch) | |
1328 | (uri (git-reference | |
1329 | (url "https://github.com/tensorflow/tensorflow.git") | |
1330 | (commit (string-append "v" version)))) | |
1331 | (file-name (string-append "tensorflow-" version "-checkout")) | |
1332 | (sha256 | |
1333 | (base32 | |
1334 | "0a9kwha395g3wgxfwln5j8vn9nkspmd75xldrlqdq540w996g8xa")))) | |
1335 | (build-system cmake-build-system) | |
1336 | (arguments | |
1337 | `(#:tests? #f ; no "check" target | |
1338 | #:build-type "Release" | |
1339 | #:configure-flags | |
1340 | (let ((protobuf (assoc-ref %build-inputs "protobuf")) | |
1341 | (protobuf:native (assoc-ref %build-inputs "protobuf:native")) | |
1342 | (jsoncpp (assoc-ref %build-inputs "jsoncpp")) | |
1343 | (snappy (assoc-ref %build-inputs "snappy")) | |
1344 | (sqlite (assoc-ref %build-inputs "sqlite"))) | |
1345 | (list | |
1346 | ;; Use protobuf from Guix | |
1347 | (string-append "-Dprotobuf_STATIC_LIBRARIES=" | |
1348 | protobuf "/lib/libprotobuf.so") | |
1349 | (string-append "-DPROTOBUF_PROTOC_EXECUTABLE=" | |
1350 | protobuf:native "/bin/protoc") | |
1351 | ||
1352 | ;; Use snappy from Guix | |
1353 | (string-append "-Dsnappy_STATIC_LIBRARIES=" | |
1354 | snappy "/lib/libsnappy.so") | |
1355 | ;; Yes, this is not actually the include directory but a prefix... | |
1356 | (string-append "-Dsnappy_INCLUDE_DIR=" snappy) | |
1357 | ||
1358 | ;; Use jsoncpp from Guix | |
1359 | (string-append "-Djsoncpp_STATIC_LIBRARIES=" | |
1360 | jsoncpp "/lib/libjsoncpp.so") | |
1361 | ;; Yes, this is not actually the include directory but a prefix... | |
1362 | (string-append "-Djsoncpp_INCLUDE_DIR=" jsoncpp) | |
1363 | ||
1364 | ;; Use sqlite from Guix | |
1365 | (string-append "-Dsqlite_STATIC_LIBRARIES=" | |
1366 | sqlite "/lib/libsqlite.a") | |
1367 | ||
1368 | ;; Use system libraries wherever possible. Currently, this | |
1369 | ;; only affects zlib. | |
1370 | "-Dsystemlib_ALL=ON" | |
1371 | "-Dtensorflow_ENABLE_POSITION_INDEPENDENT_CODE=ON" | |
1372 | "-Dtensorflow_BUILD_SHARED_LIB=ON" | |
1373 | "-Dtensorflow_OPTIMIZE_FOR_NATIVE_ARCH=OFF" | |
1374 | "-Dtensorflow_ENABLE_SSL_SUPPORT=OFF" | |
1375 | "-Dtensorflow_BUILD_CONTRIB_KERNELS=OFF")) | |
1376 | #:make-flags | |
1377 | (list "CC=gcc") | |
1378 | #:modules ((ice-9 ftw) | |
1379 | (guix build utils) | |
1380 | (guix build cmake-build-system)) | |
1381 | #:phases | |
1382 | (modify-phases %standard-phases | |
1383 | (add-after 'unpack 'set-source-file-times-to-1980 | |
1384 | ;; At the end of the tf_python_build_pip_package target, a ZIP | |
1385 | ;; archive should be generated via bdist_wheel, but it fails with | |
1386 | ;; "ZIP does not support timestamps before 1980". Luckily, | |
1387 | ;; SOURCE_DATE_EPOCH is respected, which we set to some time in | |
1388 | ;; 1980. | |
1389 | (lambda _ (setenv "SOURCE_DATE_EPOCH" "315532800") #t)) | |
1390 | ;; See https://github.com/tensorflow/tensorflow/issues/20517#issuecomment-406373913 | |
1391 | (add-after 'unpack 'python3.7-compatibility | |
1392 | (lambda _ | |
1393 | (substitute* '("tensorflow/python/eager/pywrap_tfe_src.cc" | |
1394 | "tensorflow/python/lib/core/ndarray_tensor.cc" | |
1395 | "tensorflow/python/lib/core/py_func.cc") | |
1396 | (("PyUnicode_AsUTF8") "(char *)PyUnicode_AsUTF8")) | |
1397 | (substitute* "tensorflow/c/eager/c_api.h" | |
1398 | (("unsigned char async") | |
1399 | "unsigned char is_async")) | |
1400 | ||
1401 | ;; Remove dependency on tensorboard, a complicated but probably | |
1402 | ;; optional package. | |
1403 | (substitute* "tensorflow/tools/pip_package/setup.py" | |
1404 | ((".*'tensorboard >.*") "")) | |
1405 | #t)) | |
1406 | (add-after 'python3.7-compatibility 'chdir | |
1407 | (lambda _ (chdir "tensorflow/contrib/cmake") #t)) | |
1408 | (add-after 'chdir 'disable-downloads | |
1409 | (lambda* (#:key inputs #:allow-other-keys) | |
1410 | (substitute* (find-files "external" "\\.cmake$") | |
1411 | (("GIT_REPOSITORY.*") "") | |
1412 | (("GIT_TAG.*") "") | |
1413 | (("PREFIX ") | |
1414 | "DOWNLOAD_COMMAND \"\"\nPREFIX ")) | |
1415 | ||
1416 | ;; Use packages from Guix | |
1417 | (let ((grpc (assoc-ref inputs "grpc"))) | |
1418 | (substitute* "CMakeLists.txt" | |
1419 | ;; Sqlite | |
1420 | (("include\\(sqlite\\)") "") | |
1421 | (("\\$\\{sqlite_STATIC_LIBRARIES\\}") | |
1422 | (string-append (assoc-ref inputs "sqlite") | |
1423 | "/lib/libsqlite3.so")) | |
1424 | (("sqlite_copy_headers_to_destination") "") | |
1425 | ||
1426 | ;; PNG | |
1427 | (("include\\(png\\)") "") | |
1428 | (("\\$\\{png_STATIC_LIBRARIES\\}") | |
1429 | (string-append (assoc-ref inputs "libpng") | |
1430 | "/lib/libpng16.so")) | |
1431 | (("png_copy_headers_to_destination") "") | |
1432 | ||
1433 | ;; JPEG | |
1434 | (("include\\(jpeg\\)") "") | |
1435 | (("\\$\\{jpeg_STATIC_LIBRARIES\\}") | |
1436 | (string-append (assoc-ref inputs "libjpeg") | |
1437 | "/lib/libjpeg.so")) | |
1438 | (("jpeg_copy_headers_to_destination") "") | |
1439 | ||
1440 | ;; GIF | |
1441 | (("include\\(gif\\)") "") | |
1442 | (("\\$\\{gif_STATIC_LIBRARIES\\}") | |
1443 | (string-append (assoc-ref inputs "giflib") | |
1444 | "/lib/libgif.so")) | |
1445 | (("gif_copy_headers_to_destination") "") | |
1446 | ||
1447 | ;; lmdb | |
1448 | (("include\\(lmdb\\)") "") | |
1449 | (("\\$\\{lmdb_STATIC_LIBRARIES\\}") | |
1450 | (string-append (assoc-ref inputs "lmdb") | |
1451 | "/lib/liblmdb.so")) | |
1452 | (("lmdb_copy_headers_to_destination") "") | |
1453 | ||
1454 | ;; Protobuf | |
1455 | (("include\\(protobuf\\)") "") | |
1456 | (("protobuf_copy_headers_to_destination") "") | |
1457 | (("^ +protobuf") "") | |
1458 | ||
1459 | ;; gRPC | |
1460 | (("include\\(grpc\\)") | |
1461 | "find_package(grpc REQUIRED NAMES gRPC)") | |
1462 | (("list\\(APPEND tensorflow_EXTERNAL_DEPENDENCIES grpc\\)") "") | |
1463 | ||
1464 | ;; Eigen | |
1465 | (("include\\(eigen\\)") | |
1466 | (string-append "find_package(eigen REQUIRED NAMES Eigen3) | |
1467 | set(eigen_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/external/eigen_archive " | |
1468 | (assoc-ref inputs "eigen") "/include/eigen3)")) | |
1469 | (("^ +eigen") "") | |
1470 | ||
1471 | ;; snappy | |
1472 | (("include\\(snappy\\)") | |
1473 | "add_definitions(-DTF_USE_SNAPPY)") | |
1474 | (("list\\(APPEND tensorflow_EXTERNAL_DEPENDENCIES snappy\\)") "") | |
1475 | ||
1476 | ;; jsoncpp | |
1477 | (("include\\(jsoncpp\\)") "") | |
1478 | (("^ +jsoncpp") "")) | |
1479 | ||
1480 | (substitute* "tf_core_framework.cmake" | |
1481 | ((" grpc") "") | |
1482 | (("\\$\\{GRPC_BUILD\\}/grpc_cpp_plugin") | |
1483 | (which "grpc_cpp_plugin")) | |
1484 | ;; Link with gRPC libraries | |
1485 | (("add_library\\(tf_protos_cc.*" m) | |
1486 | (string-append m | |
1487 | (format #f "\ntarget_link_libraries(tf_protos_cc PRIVATE \ | |
1488 | ~a/lib/libgrpc++_unsecure.a \ | |
1489 | ~a/lib/libgrpc_unsecure.a \ | |
1490 | ~a/lib/libaddress_sorting.a \ | |
1491 | ~a/lib/libgpr.a \ | |
1492 | ~a//lib/libcares.so | |
1493 | )\n" | |
1494 | grpc grpc grpc grpc | |
1495 | (assoc-ref inputs "c-ares")))))) | |
1496 | (substitute* "tf_tools.cmake" | |
1497 | (("add_dependencies\\(\\$\\{proto_text.*") "")) | |
1498 | ;; Remove dependency on bundled grpc | |
1499 | (substitute* "tf_core_distributed_runtime.cmake" | |
1500 | (("tf_core_cpu grpc") "tf_core_cpu")) | |
1501 | ||
1502 | ;; This directory is a dependency of many targets. | |
1503 | (mkdir-p "protobuf") | |
1504 | #t)) | |
1505 | (add-after 'configure 'unpack-third-party-sources | |
1506 | (lambda* (#:key inputs #:allow-other-keys) | |
1507 | ;; This is needed to configure bundled packages properly. | |
1508 | (setenv "CONFIG_SHELL" (which "bash")) | |
1509 | (for-each | |
1510 | (lambda (name) | |
1511 | (let* ((what (assoc-ref inputs (string-append name "-src"))) | |
1512 | (name* (string-map (lambda (c) | |
1513 | (if (char=? c #\-) | |
1514 | #\_ c)) name)) | |
1515 | (where (string-append "../build/" name* "/src/" name*))) | |
1516 | (cond | |
1517 | ((string-suffix? ".zip" what) | |
1518 | (mkdir-p where) | |
1519 | (with-directory-excursion where | |
1520 | (invoke "unzip" what))) | |
1521 | ((string-suffix? ".tar.gz" what) | |
1522 | (mkdir-p where) | |
1523 | (invoke "tar" "xf" what | |
1524 | "-C" where "--strip-components=1")) | |
1525 | (else | |
1526 | (let ((parent (dirname where))) | |
1527 | (mkdir-p parent) | |
1528 | (with-directory-excursion parent | |
1529 | (when (file-exists? name*) | |
1530 | (delete-file-recursively name*)) | |
1531 | (copy-recursively what name*) | |
1532 | (map make-file-writable | |
1533 | (find-files name* ".*")))))))) | |
1534 | (list "boringssl" | |
1535 | "cub" | |
1536 | "double-conversion" | |
1537 | "farmhash" | |
1538 | "fft2d" | |
1539 | "highwayhash" | |
1540 | "nsync" | |
1541 | "re2")) | |
1542 | ||
1543 | (rename-file "../build/cub/src/cub/cub-1.8.0/" | |
1544 | "../build/cub/src/cub/cub/") | |
1545 | #t)) | |
1546 | (add-after 'unpack 'fix-python-build | |
1547 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
1548 | (mkdir-p "protobuf-src") | |
1549 | (invoke "tar" "xf" (assoc-ref inputs "protobuf:src") | |
1550 | "-C" "protobuf-src" "--strip-components=1") | |
1551 | (mkdir-p "eigen-src") | |
1552 | (invoke "tar" "xf" (assoc-ref inputs "eigen:src") | |
1553 | "-C" "eigen-src" "--strip-components=1") | |
1554 | ||
1555 | (substitute* "tensorflow/contrib/cmake/tf_python.cmake" | |
1556 | ;; Ensure that all Python dependencies can be found at build time. | |
1557 | (("PYTHONPATH=\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/tf_python" m) | |
1558 | (string-append m ":" (getenv "PYTHONPATH"))) | |
1559 | ;; Take protobuf source files from our source package. | |
1560 | (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/protobuf/src/protobuf/src/google") | |
1561 | (string-append (getcwd) "/protobuf-src/src/google"))) | |
1562 | ||
1563 | (substitute* '("tensorflow/contrib/cmake/tf_shared_lib.cmake" | |
1564 | "tensorflow/contrib/cmake/tf_python.cmake") | |
1565 | ;; Take Eigen source files from our source package. | |
1566 | (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/eigen/src/eigen/") | |
1567 | (string-append (getcwd) "/eigen-src/")) | |
1568 | ;; Take Eigen headers from our own package. | |
1569 | (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/external/eigen_archive") | |
1570 | (string-append (assoc-ref inputs "eigen") "/include/eigen3"))) | |
1571 | ||
1572 | ;; Correct the RUNPATH of ops libraries generated for Python. | |
1573 | ;; TODO: this doesn't work :( | |
1574 | ;; /gnu/store/...-tensorflow-1.9.0/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so: | |
1575 | ;; warning: RUNPATH contains bogus entries: ("/tmp/guix-build-tensorflow-1.9.0.drv-0/source/tensorflow/contrib/build") | |
1576 | ;; /gnu/store/...-tensorflow-1.9.0/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so: | |
1577 | ;; error: depends on 'libpywrap_tensorflow_internal.so', which | |
1578 | ;; cannot be found in RUNPATH ... | |
1579 | (substitute* "tensorflow/contrib/cmake/tf_cc_ops.cmake" | |
1580 | (("set_target_properties.*") | |
1581 | (string-append "set_target_properties(${_AT_TARGET} PROPERTIES \ | |
1582 | COMPILE_FLAGS ${target_compile_flags} \ | |
1583 | INSTALL_RPATH_USE_LINK_PATH TRUE \ | |
1584 | INSTALL_RPATH " (assoc-ref outputs "out") "/lib)\n"))) | |
1585 | #t)) | |
1586 | (add-after 'build 'build-pip-package | |
1587 | (lambda* (#:key outputs #:allow-other-keys) | |
1588 | (setenv "LDFLAGS" | |
1589 | (string-append "-Wl,-rpath=" | |
1590 | (assoc-ref outputs "out") "/lib")) | |
1591 | (invoke "make" "tf_python_build_pip_package") | |
1592 | #t)) | |
1593 | (add-after 'build-pip-package 'install-python | |
1594 | (lambda* (#:key outputs #:allow-other-keys) | |
1595 | (let ((out (assoc-ref outputs "out")) | |
1596 | (wheel (car (find-files "../build/tf_python/dist/" "\\.whl$")))) | |
1597 | (invoke "python" "-m" "pip" "install" wheel | |
1598 | (string-append "--prefix=" out)) | |
1599 | ||
1600 | ;; XXX: broken RUNPATH, see fix-python-build phase. | |
1601 | (delete-file | |
1602 | (string-append | |
1603 | out "/lib/python3.7/site-packages/tensorflow/contrib/" | |
1604 | "seq2seq/python/ops/lib_beam_search_ops.so")) | |
1605 | #t)))))) | |
1606 | (native-inputs | |
1607 | `(("pkg-config" ,pkg-config) | |
1608 | ("protobuf:native" ,protobuf-next) ; protoc | |
1609 | ("protobuf:src" ,(package-source protobuf-next)) | |
1610 | ("eigen:src" ,(package-source eigen-for-tensorflow)) | |
1611 | ;; The commit hashes and URLs for third-party source code are taken | |
1612 | ;; from "tensorflow/workspace.bzl". | |
1613 | ("boringssl-src" | |
1614 | ,(let ((commit "ee7aa02") | |
1615 | (revision "1")) | |
1616 | (origin | |
1617 | (method git-fetch) | |
1618 | (uri (git-reference | |
1619 | (url "https://boringssl.googlesource.com/boringssl") | |
1620 | (commit commit))) | |
1621 | (file-name (string-append "boringssl-0-" revision | |
1622 | (string-take commit 7) | |
1623 | "-checkout")) | |
1624 | (sha256 | |
1625 | (base32 | |
1626 | "1jf693q0nw0adsic6cgmbdx6g7wr4rj4vxa8j1hpn792fqhd8wgw"))))) | |
1627 | ("cub-src" | |
1628 | ,(let ((version "1.8.0")) | |
1629 | (origin | |
1630 | (method url-fetch) | |
1631 | (uri (string-append "https://mirror.bazel.build/github.com/NVlabs/" | |
1632 | "cub/archive/" version ".zip")) | |
1633 | (file-name (string-append "cub-" version ".zip")) | |
1634 | (sha256 | |
1635 | (base32 | |
1636 | "1hsqikqridb90dkxkjr2918dcry6pfh46ccnwrzawl56aamhdykb"))))) | |
1637 | ("double-conversion-src" | |
1638 | ,(let ((commit "5664746") | |
1639 | (revision "1")) | |
1640 | (origin | |
1641 | (method git-fetch) | |
1642 | (uri (git-reference | |
1643 | (url "https://github.com/google/double-conversion.git") | |
1644 | (commit commit))) | |
1645 | (file-name | |
1646 | (git-file-name "double-conversion" | |
1647 | (string-append "0-" revision "." | |
1648 | (string-take commit 7)))) | |
1649 | (sha256 | |
1650 | (base32 | |
1651 | "1h5lppqqxcvdg5jq42i5msgwx20ryij3apvmndflngrgdpc04gn1"))))) | |
1652 | ("farmhash-src" | |
1653 | ,(let ((commit "816a4ae622e964763ca0862d9dbd19324a1eaf45")) | |
1654 | (origin | |
1655 | (method url-fetch) | |
1656 | (uri (string-append | |
1657 | "https://mirror.bazel.build/github.com/google/farmhash/archive/" | |
1658 | commit ".tar.gz")) | |
1659 | (file-name (string-append "farmhash-0-" (string-take commit 7) | |
1660 | ".tar.gz")) | |
1661 | (sha256 | |
1662 | (base32 | |
1663 | "185b2xdxl4d4cnsnv6abg8s22gxvx8673jq2yaq85bz4cdy58q35"))))) | |
1664 | ;; The license notice on the home page at | |
1665 | ;; http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html says: | |
1666 | ;; Copyright Takuya OOURA, 1996-2001 | |
1667 | ;; | |
1668 | ;; You may use, copy, modify and distribute this code for any purpose | |
1669 | ;; (include commercial use) and without fee. Please refer to this | |
1670 | ;; package when you modify this code. | |
1671 | ;; | |
1672 | ;; We take the identical tarball from the Bazel mirror, because the URL | |
1673 | ;; at the home page is not versioned and might change. | |
1674 | ("fft2d-src" | |
1675 | ,(origin | |
1676 | (method url-fetch) | |
1677 | (uri "https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz") | |
1678 | (file-name "fft2d.tar.gz") | |
1679 | (sha256 | |
1680 | (base32 | |
1681 | "15jjkfvhqvl2c0753d2di8hz0pyzn598g74wqy79awdrf1y67fsj")))) | |
1682 | ("highwayhash-src" | |
1683 | ,(let ((commit "be5edafc2e1a455768e260ccd68ae7317b6690ee") | |
1684 | (revision "1")) | |
1685 | (origin | |
1686 | (method git-fetch) | |
1687 | (uri (git-reference | |
1688 | (url "https://github.com/google/highwayhash.git") | |
1689 | (commit commit))) | |
1690 | (file-name (string-append "highwayhash-0-" revision | |
1691 | (string-take commit 7) | |
1692 | "-checkout")) | |
1693 | (sha256 | |
1694 | (base32 | |
1695 | "154jwf98cyy54hldr94pgjn85zynly3abpnc1avmb8a18lzwjyb6"))))) | |
1696 | ("nsync-src" | |
1697 | ,(let ((version "0559ce013feac8db639ee1bf776aca0325d28777") | |
1698 | (revision "1")) | |
1699 | (origin | |
1700 | (method url-fetch) | |
1701 | (uri (string-append "https://mirror.bazel.build/" | |
1702 | "github.com/google/nsync/archive/" | |
1703 | version ".tar.gz")) | |
1704 | (file-name (string-append "nsync-0." revision | |
1705 | "-" (string-take version 7) | |
1706 | ".tar.gz")) | |
1707 | (sha256 | |
1708 | (base32 | |
1709 | "0qdkyqym34x739mmzv97ah5r7ph462v5xkxqxvidmcfqbi64b132"))))) | |
1710 | ("re2-src" | |
1711 | ,(let ((commit "e7efc48") | |
1712 | (revision "1")) | |
1713 | (origin | |
1714 | (method git-fetch) | |
1715 | (uri (git-reference | |
1716 | (url "https://github.com/google/re2") | |
1717 | (commit commit))) | |
1718 | (file-name (string-append "re2-0-" revision | |
1719 | (string-take commit 7) | |
1720 | "-checkout")) | |
1721 | (sha256 | |
1722 | (base32 | |
1723 | "161g9841rjfsy5pn52fcis0s9hdr7rxvb06pad38j5rppfihvign"))))) | |
1724 | ("googletest" ,googletest) | |
1725 | ("swig" ,swig) | |
1726 | ("unzip" ,unzip))) | |
1727 | (propagated-inputs | |
1728 | `(("python-absl-py" ,python-absl-py) | |
1729 | ("python-astor" ,python-astor) | |
1730 | ("python-gast" ,python-gast) | |
1731 | ("python-grpcio" ,python-grpcio) | |
1732 | ("python-numpy" ,python-numpy) | |
1733 | ("python-protobuf" ,python-protobuf-next) | |
1734 | ("python-six" ,python-six) | |
1735 | ("python-termcolo" ,python-termcolor) | |
1736 | ("python-wheel" ,python-wheel))) | |
1737 | (inputs | |
1738 | `(("c-ares" ,c-ares-next) | |
1739 | ("eigen" ,eigen-for-tensorflow) | |
1740 | ("gemmlowp" ,gemmlowp-for-tensorflow) | |
1741 | ("lmdb" ,lmdb) | |
1742 | ("libjpeg" ,libjpeg) | |
1743 | ("libpng" ,libpng) | |
1744 | ("giflib" ,giflib) | |
1745 | ("grpc" ,grpc) | |
1746 | ("jsoncpp" ,jsoncpp-for-tensorflow) | |
1747 | ("snappy" ,snappy) | |
1748 | ("sqlite" ,sqlite) | |
1749 | ("protobuf" ,protobuf-next) | |
1750 | ("python" ,python-wrapper) | |
1751 | ("zlib" ,zlib))) | |
1752 | (home-page "https://tensorflow.org") | |
1753 | (synopsis "Machine learning framework") | |
1754 | (description | |
1755 | "TensorFlow is a flexible platform for building and training machine | |
1756 | learning models. It provides a library for high performance numerical | |
1757 | computation and includes high level Python APIs, including both a sequential | |
1758 | API for beginners that allows users to build models quickly by plugging | |
1759 | together building blocks and a subclassing API with an imperative style for | |
1760 | advanced research.") | |
1761 | (license license:asl2.0))) | |
d60b064d NG |
1762 | |
1763 | (define-public python-iml | |
1764 | (package | |
1765 | (name "python-iml") | |
1766 | (version "0.6.2") | |
1767 | (source | |
1768 | (origin | |
1769 | (method url-fetch) | |
1770 | (uri (pypi-uri "iml" version)) | |
1771 | (sha256 | |
1772 | (base32 | |
1773 | "1k8szlpm19rcwcxdny9qdm3gmaqq8akb4xlvrzyz8c2d679aak6l")))) | |
1774 | (build-system python-build-system) | |
1775 | (propagated-inputs | |
1776 | `(("ipython" ,python-ipython) | |
1777 | ("nose" ,python-nose) | |
1778 | ("numpy" ,python-numpy) | |
1779 | ("pandas" ,python-pandas) | |
1780 | ("scipy" ,python-scipy))) | |
1781 | (home-page "http://github.com/interpretable-ml/iml") | |
1782 | (synopsis "Interpretable Machine Learning (iML) package") | |
1783 | (description "Interpretable ML (iML) is a set of data type objects, | |
1784 | visualizations, and interfaces that can be used by any method designed to | |
1785 | explain the predictions of machine learning models (or really the output of | |
1786 | any function). It currently contains the interface and IO code from the Shap | |
1787 | project, and it will potentially also do the same for the Lime project.") | |
1788 | (license license:expat))) | |
d93ad191 RW |
1789 | |
1790 | (define-public python-keras-applications | |
1791 | (package | |
1792 | (name "python-keras-applications") | |
1793 | (version "1.0.8") | |
1794 | (source | |
1795 | (origin | |
1796 | (method url-fetch) | |
1797 | (uri (pypi-uri "Keras_Applications" version)) | |
1798 | (sha256 | |
1799 | (base32 | |
1800 | "1rcz31ca4axa6kzhjx4lwqxbg4wvlljkj8qj9a7p9sfd5fhzjyam")))) | |
1801 | (build-system python-build-system) | |
1802 | ;; The tests require Keras, but this package is needed to build Keras. | |
1803 | (arguments '(#:tests? #f)) | |
1804 | (propagated-inputs | |
1805 | `(("python-h5py" ,python-h5py) | |
1806 | ("python-numpy" ,python-numpy))) | |
1807 | (native-inputs | |
1808 | `(("python-pytest" ,python-pytest) | |
1809 | ("python-pytest-cov" ,python-pytest-cov) | |
1810 | ("python-pytest-pep8" ,python-pytest-pep8) | |
1811 | ("python-pytest-xdist" ,python-pytest-xdist))) | |
1812 | (home-page "https://github.com/keras-team/keras-applications") | |
1813 | (synopsis "Reference implementations of popular deep learning models") | |
1814 | (description | |
1815 | "This package provides reference implementations of popular deep learning | |
1816 | models for use with the Keras deep learning framework.") | |
1817 | (license license:expat))) | |
4abc5066 RW |
1818 | |
1819 | (define-public python-keras-preprocessing | |
1820 | (package | |
1821 | (name "python-keras-preprocessing") | |
1822 | (version "1.1.0") | |
1823 | (source | |
1824 | (origin | |
1825 | (method url-fetch) | |
1826 | (uri (pypi-uri "Keras_Preprocessing" version)) | |
1827 | (sha256 | |
1828 | (base32 | |
1829 | "1r98nm4k1svsqjyaqkfk23i31bl1kcfcyp7094yyj3c43phfp3as")))) | |
1830 | (build-system python-build-system) | |
1831 | (propagated-inputs | |
1832 | `(("python-numpy" ,python-numpy) | |
1833 | ("python-six" ,python-six))) | |
1834 | (native-inputs | |
1835 | `(("python-pandas" ,python-pandas) | |
1836 | ("python-pillow" ,python-pillow) | |
1837 | ("python-pytest" ,python-pytest) | |
1838 | ("python-pytest-cov" ,python-pytest-cov) | |
1839 | ("python-pytest-xdist" ,python-pytest-xdist) | |
1840 | ("tensorflow" ,tensorflow))) | |
1841 | (home-page "https://github.com/keras-team/keras-preprocessing/") | |
1842 | (synopsis "Data preprocessing and augmentation for deep learning models") | |
1843 | (description | |
1844 | "Keras Preprocessing is the data preprocessing and data augmentation | |
1845 | module of the Keras deep learning library. It provides utilities for working | |
1846 | with image data, text data, and sequence data.") | |
1847 | (license license:expat))) | |
f1765b57 RW |
1848 | |
1849 | (define-public python-keras | |
1850 | (package | |
1851 | (name "python-keras") | |
1852 | (version "2.2.4") | |
1853 | (source | |
1854 | (origin | |
1855 | (method url-fetch) | |
1856 | (uri (pypi-uri "Keras" version)) | |
1857 | (sha256 | |
1858 | (base32 | |
1859 | "1j8bsqzh49vjdxy6l1k4iwax5vpjzniynyd041xjavdzvfii1dlh")))) | |
1860 | (build-system python-build-system) | |
1861 | (arguments | |
1862 | `(#:phases | |
1863 | (modify-phases %standard-phases | |
1864 | (add-after 'unpack 'remove-tests-for-unavailable-features | |
1865 | (lambda _ | |
1866 | (delete-file "keras/backend/theano_backend.py") | |
1867 | (delete-file "keras/backend/cntk_backend.py") | |
1868 | (delete-file "tests/keras/backend/backend_test.py") | |
1869 | ||
1870 | ;; FIXME: This doesn't work because Tensorflow is missing the | |
1871 | ;; coder ops library. | |
1872 | (delete-file "tests/keras/test_callbacks.py") | |
1873 | #t)) | |
1874 | (replace 'check | |
1875 | (lambda _ | |
1876 | ;; These tests attempt to download data files from the internet. | |
1877 | (delete-file "tests/integration_tests/test_datasets.py") | |
1878 | (delete-file "tests/integration_tests/imagenet_utils_test.py") | |
1879 | ||
1880 | (setenv "PYTHONPATH" | |
1881 | (string-append (getcwd) "/build/lib:" | |
1882 | (getenv "PYTHONPATH"))) | |
1883 | (invoke "py.test" "-v" | |
1884 | "-p" "no:cacheprovider" | |
1885 | "--ignore" "keras/utils")))))) | |
1886 | (propagated-inputs | |
1887 | `(("python-h5py" ,python-h5py) | |
1888 | ("python-keras-applications" ,python-keras-applications) | |
1889 | ("python-keras-preprocessing" ,python-keras-preprocessing) | |
1890 | ("python-numpy" ,python-numpy) | |
1891 | ("python-pydot" ,python-pydot) | |
1892 | ("python-pyyaml" ,python-pyyaml) | |
1893 | ("python-scipy" ,python-scipy) | |
1894 | ("python-six" ,python-six) | |
1895 | ("tensorflow" ,tensorflow) | |
1896 | ("graphviz" ,graphviz))) | |
1897 | (native-inputs | |
1898 | `(("python-pandas" ,python-pandas) | |
1899 | ("python-pytest" ,python-pytest) | |
1900 | ("python-pytest-cov" ,python-pytest-cov) | |
1901 | ("python-pytest-pep8" ,python-pytest-pep8) | |
1902 | ("python-pytest-timeout" ,python-pytest-timeout) | |
1903 | ("python-pytest-xdist" ,python-pytest-xdist) | |
1904 | ("python-sphinx" ,python-sphinx) | |
1905 | ("python-requests" ,python-requests))) | |
1906 | (home-page "https://github.com/keras-team/keras") | |
1907 | (synopsis "High-level deep learning framework") | |
1908 | (description "Keras is a high-level neural networks API, written in Python | |
1909 | and capable of running on top of TensorFlow. It was developed with a focus on | |
1910 | enabling fast experimentation. Use Keras if you need a deep learning library | |
1911 | that: | |
1912 | ||
1913 | @itemize | |
1914 | @item Allows for easy and fast prototyping (through user friendliness, | |
1915 | modularity, and extensibility). | |
1916 | @item Supports both convolutional networks and recurrent networks, as well as | |
1917 | combinations of the two. | |
1918 | @item Runs seamlessly on CPU and GPU. | |
1919 | @end itemize\n") | |
1920 | (license license:expat))) |