#!/bin/bash # /* vim: set filetype=sh : */ -*- sh -*- # Q0: where will the output be stored Safe=${Safe=${HOME}/var/weka} # Q1: where is your data? Data=${Data="/var/tmp/discrete"} # Q2: what data sets will we run? # A2: only those with binary discrete classes; i.e. Datums=${Datums="a2b/breast-cancer a2b/breast-w c2d/colic c2d/colic.ORIG c2d/credit-a c2d/credit-g c2d/diabetes e2i/heart-statlog e2i/hepatitis e2i/ionosphere j2p/kr-vs-kp j2p/mushroom q2s/sick q2s/sonar t2z/vote"} # A2': just a couple #Datums=" c2d/diabetes a2b/breast-cancer q2s/sonar t2z/vote " # Q3: what learners will you try? Learners=${Learners="bayes nbk j48 oneR"} jAode() { wttp $1 $2 $wAode | gotwant ; } j48() { wttp $1 $2 $wJ48 | gotwant ; } bayes() { wttp $1 $2 $wBayes | gotwant ; } #cp $1 ${Safe}/${1}bayes.arff ; } nbk() { wttp $1 $2 $wNbk | gotwant ; } oneR() { wttp $1 $2 $wOneR | gotwant ; } [ -f "$Functions" ] && . $Functions # Q4 : what pre-processors will you use Preps=${Preps="cat tbin fayyadIrani"} disctree() { dtree2 Pass=1 $1 Pass=2 $1; } tbin() { tenbins Pass=1 $1 Pass=2 $1 Pass=3 $1; } # Q5: how many repeats? Repeats=${Repeats=1} # Q6: how many bins? Bins=${Bins=3} # All right then. Lets go! mkdir -p $Safe # ensure safe place exists Tmp=`mktemp -d` # make a sandbox where only you will play trap "rm -rf $Tmp" 0 1 2 3 15 # leave nothing behind when you quit cd $Tmp # go to the sandbox main() { set -x for datum in $Datums do echo "#data,learner,prep,goal,train,test,repeats,bin,accuracy,pd,pf,precision" for prep in $Preps do $prep ${Data}/${datum}.arff > data.arff # cp data.arff $Safe/${prep}data.arff # emacs $Safe/${prep}data.arff # emacs $Safe/data2.arff & for((repeats=1;repeats<=$Repeats;repeats++)) do one=`nthclass Want=1 data.arff` # negative = class 1 two=`nthclass Want=2 data.arff` # positive = class 2 seed=$RANDOM for((bin=1;bin<=${Bins};bin++)) do somearff Bin=$bin Bins=$Bins Seed=$seed data.arff n1=`instances train.arff` n2=`instances test.arff` for learn in $Learners do b4="$datum,$learn,$prep,$two,$n1,$n2,$repeats,$bin"; $learn train.arff test.arff | abcd Prefix="${b4}" False="${one}" True="${two}" done; done; done; done; done } Log=$$ (main | tee $Safe/xval.$Log ) 2> $Safe/xval.err.$Log echo $Safe/xval.$Log