automatic commit
[mlp.git] / doit.sh
diff --git a/doit.sh b/doit.sh
new file mode 100755 (executable)
index 0000000..bd6f195
--- /dev/null
+++ b/doit.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+#  mlp-mnist is an implementation of a multi-layer neural network.
+#
+#  Copyright (c) 2008 Idiap Research Institute, http://www.idiap.ch/
+#  Written by Francois Fleuret <francois.fleuret@idiap.ch>
+#
+#  This file is part of mlp-mnist.
+#
+#  mlp-mnist is free software: you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 3 as
+#  published by the Free Software Foundation.
+#
+#  mlp-mnist is distributed in the hope that it will be useful, but
+#  WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with mlp-mnist.  If not, see <http://www.gnu.org/licenses/>.
+
+make -k ann
+
+if [[ $1 == "--download-mnist" ]]; then
+    for f in train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte t10k-labels-idx1-ubyte; do
+        if [[ ! -f "./$f" ]]; then
+            echo "Could not find $f, downloading it."
+            wget http://yann.lecun.com/exdb/mnist/$f.gz
+            gunzip $f.gz
+        fi
+    done
+fi
+
+for f in train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte t10k-labels-idx1-ubyte; do
+    if [[ -f "./$f" ]]; then
+        echo "Found $f, good."
+    else
+        echo "File $f is missing. Try $0 --download-mnist."
+        exit 1
+    fi
+done
+
+./ann --nb-training-examples 20000 --nb-validation-examples 20000 \
+    --mlp-structure 784,200,10 \
+    --data-files ./train-images-idx3-ubyte ./train-labels-idx1-ubyte \
+    --save-mlp simple.mlp
+
+./ann --load-mlp simple.mlp \
+    --data-files ./t10k-images-idx3-ubyte ./t10k-labels-idx1-ubyte \
+    --nb-test-examples 10000