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