Added #include <unistd.h> for nice().
[mlp.git] / doit.sh
1 #!/bin/bash
2
3 #  mlp-mnist is an implementation of a multi-layer neural network.
4 #
5 #  Copyright (c) 2006 École Polytechnique Fédérale de Lausanne,
6 #  http://www.epfl.ch
7 #
8 #  Written by Francois Fleuret <francois@fleuret.org>
9 #
10 #  This file is part of mlp-mnist.
11 #
12 #  mlp-mnist is free software: you can redistribute it and/or modify
13 #  it under the terms of the GNU General Public License version 3 as
14 #  published by the Free Software Foundation.
15 #
16 #  mlp-mnist is distributed in the hope that it will be useful, but
17 #  WITHOUT ANY WARRANTY; without even the implied warranty of
18 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 #  General Public License for more details.
20 #
21 #  You should have received a copy of the GNU General Public License
22 #  along with mlp-mnist.  If not, see <http://www.gnu.org/licenses/>.
23
24 make -k mlp
25
26 if [[ $1 ]]; then
27
28     if [[ $1 == "--download-mnist" ]]; then
29         for f in train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte t10k-labels-idx1-ubyte; do
30             if [[ ! -f "./$f" ]]; then
31                 echo "Could not find $f, downloading it."
32                 wget http://yann.lecun.com/exdb/mnist/$f.gz
33                 gunzip $f.gz
34             fi
35         done
36     else
37
38         echo "Unknown option $1"
39         exit 1
40
41     fi
42 fi
43
44 for f in train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte t10k-labels-idx1-ubyte; do
45     if [[ -f "./$f" ]]; then
46         echo "Found $f, good."
47     else
48         echo "File $f is missing. Try $0 --download-mnist."
49         exit 1
50     fi
51 done
52
53 ./mlp \
54     --nb-training-examples 20000 --nb-validation-examples 20000 \
55     --mlp-structure 784,200,10 \
56     --data-files ./train-images-idx3-ubyte ./train-labels-idx1-ubyte \
57     --save-mlp simple.mlp
58
59 ./mlp \
60     --load-mlp simple.mlp \
61     --data-files ./t10k-images-idx3-ubyte ./t10k-labels-idx1-ubyte \
62     --nb-test-examples 10000