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