Commits

Oliver Gu  committed 6282fe3

Improved svmguide scripts.

  • Participants
  • Parent commits 4ee08e0

Comments (0)

Files changed (3)

File svmguide/common.sh

 #!/bin/bash
 
+URL="http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets"
 DATADIR="./data"
 SVMCLI="../svm_cli.native"
 
 download ()
 {
+  CATEGORY=$1
+  shift
   mkdir -p $DATADIR
   for file in $*; do
     if [ ! -f "$DATADIR/$file" ]; then
       printf "Downloading file '$file'..."
-      wget -q -P $DATADIR "$URL/$file"
-      if [ "$?" != "0" ]; then
-        printf " failed!\n"; exit 1
+      if wget -q -P $DATADIR "$URL/$CATEGORY/$file"; then
+        echo " done!"
       else
-        printf " finished!\n"
+        echo " failed!"; exit 1
       fi
     fi
   done

File svmguide/svmguide1.sh

 # www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf and executes the second
 # command set on page 9 with the OCaml command line interface in quiet mode.
 
-URL="http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary"
+CATEGORY="binary"
 TRAINFILE="svmguide1"
 TESTFILE="svmguide1.t"
 
 source 'common.sh'
 
-download "$TRAINFILE" "$TESTFILE" && check_svm_cli
+download $CATEGORY $TRAINFILE $TESTFILE && check_svm_cli
 
 TRAINFILE="$DATADIR/$TRAINFILE"
 TESTFILE="$DATADIR/$TESTFILE"

File svmguide/svmguide2.sh

 # www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf and executes the second
 # command set on page 10 with the OCaml command line interface in quiet mode.
 
-URL="http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass"
+CATEGORY=multiclass
 TRAINFILE="svmguide2"
 
 source 'common.sh'
 
-download $TRAINFILE && check_svm_cli
+download $CATEGORY $TRAINFILE && check_svm_cli
 
 TRAINFILE="$DATADIR/$TRAINFILE"