Subject: Re: [bug#30266] Add FANN

From: Mark Meyer <[email-masked]>
Date: Thu, 01 Feb 2018 16:32:51 +0100

Thanks for the good feedback. Please consider the attached patch.

Best, Mark

On Sun, Jan 28, 2018, at 03:13, Ben Woodcroft wrote:
> Hi Mark,

> Thanks for the patch.

>> +(define-module (gnu packages ai) +  #:use-module ((guix licenses)
>> #:prefix license:) +  #:use-module (guix utils) +  #:use-module (guix
>> download) +  #:use-module (guix packages) +  #:use-module (guix build-
>> system cmake) +  #:use-module (guix git-download) +  #:use-module
>> (gnu packages))> I think machine-learning.scm would be a good home for this package, so
> a new file wouldn't be needed.> 
> 

>> + +(define-public libfann +  (package +    (name "libfann") +
>>   (version "d71d54788b")> 

> The last release is 129 commits behind and it has been some time, so I
> think you are right - we should package from a git commit.> Usually we package from git using this style though (i.e. reason for
> not using the release, use of 'file-name', and a version that includes
> the last release followed by '-1.<commit>').>   ;; There are no recent releases so we package from git.
>    (let ((commit "da121155a977197cab9fbb15953ca1b40b11eb87"))
>      (package
>        (name "newick-utils")
>        (version (string-append "1.6-1." (string-take commit 8)))
>        (source (origin
>                  (method git-fetch)
>                  (uri (git-reference
>                        (url "
>                        https://github.com/tjunier/newick_utils.git")>                        (commit commit)))
>                  (file-name (string-append name "-" version "-
>                  checkout"))>                  (sha256
>                   (base32
>                    "1hkw21rq1mwf7xp0rmbb2gqc0i6p11108m69i7mr7xcjl268p-
>                    xnb"))))> 

>> +    (source (origin +              (method git-fetch) +
>>      (uri (git-reference +                    (url "
>>      https://github.com/libfann/fann.git") +
>>      (commit version))) +              (sha256 +
>>      (base32 +                "0ibwpfrjs6q2lijs8slxjgzb2llcl6rk3v2sk-
>>      i4r6215g5jjhg3x")))) +    (build-system cmake-build-system) +
>>      (arguments +     `(#:tests? #f))> I see from the website:
> 

>> Once you have installed the library you can test it out by going to
>> the examples directory and type make runtest, which will compile the
>> examples and run a few of them to test that everything is working.> Is that possible? Ideally, since there are tests it would be good to
> run them.> 
>
>> +    (home-page "http://leenissen.dk/fann/wp/") +    (synopsis "Fast
>>      Artificial Neural Network") +    (description +     "FANN is a
>>      free open source neural network library, which implements
>>      +multilayer artificial neural networks in C with support for
>>      both fully +connected and sparsely connected networks.") +
>>      (license license:lgpl2.1)))> Otherwise LGTM. Can you send an updated patch please?
> 

> Thanks, ben

--
Mark Meyer
[email-masked]

From 7c6eaae56bc9ef57b60ceacf49a33cdd5966b361 Mon Sep 17 00:00:00 2001
From: Mark Meyer <[email-masked]>
Date: Thu, 1 Feb 2018 15:07:58 +0100
Subject: [PATCH] gnu: Add fann.

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

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index bd13cedcb..faa4bdf7f 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2016, 2017 Marius Bakke <[email-masked]>
 ;;; Copyright © 2016 Hartmut Goebel <[email-masked]>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <[email-masked]>
+;;; Copyright © 2018 Mark Meyer <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@
   #:use-module (guix build-system ocaml)
   #:use-module (guix build-system python)
   #:use-module (guix build-system r)
+  #:use-module (guix git-download)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages boost)
@@ -50,6 +52,35 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
+(define-public fann
+  (let ((commit "d71d54788bee56ba4cf7522801270152da5209d7"))
+    (package
+      (name "fann")
+      (version (string-append "2.2.0-1." (string-take commit 8)))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/libfann/fann.git")
+                      (commit version)))
+                (sha256
+                 (base32
+                  "0ibwpfrjs6q2lijs8slxjgzb2llcl6rk3v2ski4r6215g5jjhg3x"))))
+      (build-system cmake-build-system)
+      (arguments
+       `(#:phases (modify-phases %standard-phases
+                    (replace 'check
+                      (lambda* (#:key outputs #:allow-other-keys)
+                        (let* ((out (assoc-ref outputs "out")))
+                          (with-directory-excursion (string-append (getcwd) "/tests")
+                            (invoke "./fann_tests"))))))))
+      (home-page "http://leenissen.dk/fann/wp/")
+      (synopsis "Fast Artificial Neural Network")
+      (description
+       "FANN is a free open source neural network library, which implements
+multilayer artificial neural networks in C with support for both fully
+connected and sparsely connected networks.")
+      (license license:lgpl2.1))))
+
 (define-public libsvm
   (package
     (name "libsvm")
-- 
2.15.1