Commits

Oliver Gu committed 2be9ae7

Added second svmguide script and reorganized the scripts in the svmguide directory.

Comments (0)

Files changed (7)

 *.byte
 /setup.log
 /setup.data
-/data
+/svmguide/data
 /_log
 /_build
 Plugins:           META (0.3), StdFiles (0.3), DevFiles (0.3)
 XStdFilesREADME:   false
 BuildTools:        ocamldoc, ocamlbuild
-
+PostDistcleanCommand: $rmdir svmguide/data
 
 
 Library svm
 (* setup.ml generated for the first time by OASIS v0.2.0 *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: 7c30cd7ad01d50e144f5d9dc1e019b4f) *)
+(* DO NOT EDIT (digest: 66eac9efdc29568e51aacfa8c94ddf43) *)
 (*
    Regenerated by OASIS v0.3.0
    Visit http://oasis.forge.ocamlcore.org for more information and
           distclean_custom =
             {
                pre_command = [(OASISExpr.EBool true, None)];
-               post_command = [(OASISExpr.EBool true, None)];
+               post_command =
+                 [
+                    (OASISExpr.EBool true,
+                      Some (("$rmdir", ["svmguide/data"])))
+                 ];
                };
           files_ab = [];
           sections =
           };
      oasis_fn = Some "_oasis";
      oasis_version = "0.3.0";
-     oasis_digest = Some "\030t\203\178\015\168UF\128&\170\215\179\0244\230";
+     oasis_digest = Some "1oY\187\132\137\169HT\211\247\235\246w%\227";
      oasis_exec = None;
      oasis_setup_args = [];
      setup_update = false;
 
 let setup () = BaseSetup.setup setup_t;;
 
-# 6002 "setup.ml"
+# 6006 "setup.ml"
 (* OASIS_STOP *)
 let () = setup ();;

svmguide.sh

-#!/bin/bash
-
-# This script downloads the Astroparticle dataset mentioned in the SVM guide
-# 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.
-
-URL="http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary"
-DATADIR="./data"
-
-TRAINFILE=svmguide1
-TESTFILE=svmguide1.t
-
-SVM="./svm_cli.native"
-
-if [ ! -f "$DATADIR/$TRAINFILE" ] || [ ! -f "$DATADIR/$TESTFILE" ]
-then
-  printf "Downloading training and testing data..."
-  mkdir   -p $DATADIR &&
-  wget -q -P $DATADIR "$URL/$TRAINFILE" &&
-  wget -q -P $DATADIR "$URL/$TESTFILE"
-  printf " finished!\n"
-fi
-
-if [ ! -f "$SVM" ]
-then
-  echo "$SVM not found. Type 'make' for building it."
-  exit 1
-fi
-
-TRAINFILE="$DATADIR/$TRAINFILE"
-TESTFILE="$DATADIR/$TESTFILE"
-SCALEPARAMSFILE="$DATADIR/range1"
-
-$SVM scale -l -1 -u 1 -s $SCALEPARAMSFILE $TRAINFILE > $TRAINFILE.scale &&
-$SVM scale -r $SCALEPARAMSFILE $TESTFILE > $TESTFILE.scale &&
-$SVM train $TRAINFILE.scale &&
-$SVM predict $TESTFILE.scale $TRAINFILE.scale.model $TESTFILE.predict

svmguide/common.sh

+#!/bin/bash
+
+DATADIR="./data"
+SVMCLI="../svm_cli.native"
+
+download ()
+{
+  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
+      else
+        printf " finished!\n"
+      fi
+    fi
+  done
+}
+
+check_svm_cli ()
+{
+  if [ ! -f "$SVMCLI" ]; then
+    echo "$SVMCLI not found. You have to build it first."
+    exit 1
+  fi
+}

svmguide/svmguide1.sh

+#!/bin/bash
+
+# This script downloads the Astroparticle dataset mentioned in the SVM guide
+# 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"
+TRAINFILE="svmguide1"
+TESTFILE="svmguide1.t"
+
+source 'common.sh'
+
+download "$TRAINFILE" "$TESTFILE" && check_svm_cli
+
+TRAINFILE="$DATADIR/$TRAINFILE"
+TESTFILE="$DATADIR/$TESTFILE"
+SCALEPARAMSFILE="$DATADIR/range1"
+
+$SVMCLI scale -l -1 -u 1 -s $SCALEPARAMSFILE $TRAINFILE > $TRAINFILE.scale &&
+$SVMCLI scale -r $SCALEPARAMSFILE $TESTFILE > $TESTFILE.scale &&
+$SVMCLI train -q $TRAINFILE.scale &&
+$SVMCLI predict $TESTFILE.scale $TRAINFILE.scale.model $TESTFILE.predict

svmguide/svmguide2.sh

+#!/bin/bash
+
+# This script downloads the Bioinformatics dataset mentioned in the SVM guide
+# 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"
+TRAINFILE="svmguide2"
+
+source 'common.sh'
+
+download $TRAINFILE && check_svm_cli
+
+TRAINFILE="$DATADIR/$TRAINFILE"
+
+# remove additional spaces after class labels
+sed -i -e 's/^\(+[0-9]\) */\1 /g' $TRAINFILE
+
+$SVMCLI scale -l -1 -u 1 $TRAINFILE > $TRAINFILE.scale &&
+$SVMCLI train -q -v 5 $TRAINFILE.scale
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.