#! /bin/bash #example: ./effort data/nasa93.csv COCII precise log/seed.log name lc #Argument Key # 1 Filename # 2 Effort Multiplier Method (COC81 or COCII) # 3 Effort Multiplier Precision (precise or rounded) # 4 Seed Filename # 5 Name as source:part # 6 Learner #Variables Filename=$1 Iterations=30 TestSets=10 #Path=${1/%.csv/} Path=/tmp/effort rm -r $Path mkdir $Path LogFile=$Path/lc.log #SeedFile=$Path/seed.log SeedFile=$4 TestFile=$Path/test.tmp TrainFile=$Path/train.tmp #gawk 'END{print NR;}' $Path/train.tmp > $Path/trainCount.tmp ConvertedFile=$Path/converted.csv StatsFile=$Path/stats.tmp #Preprocess data files gawk -f convertCSV.awk Method=$2 Style=$3 $Filename > $ConvertedFile rm -f $LogFile rm -f $SeedFile #Run the algorithm many times for ((i=1;i<=$Iterations;i++)) do #Randomize Data rm -f $TrainFile rm -f $TestFile Seed=$RANDOM gawk -f randomize.awk -v Seed=$Seed -v TestSets=$TestSets -v TrainFile=$TrainFile -v TestFile=$TestFile $ConvertedFile gawk -f lc.awk Pass=1 $TrainFile Pass=2 $TestFile >> $LogFile echo $Seed >> $SeedFile done gawk -f stats.awk $LogFile > $StatsFile #gawk -f subsetDisplay.awk $StatsFile Train=$(gawk 'END{print NR;}' $TrainFile) Subset=$(gawk 'BEGIN{FS=",";} NR==1{print NF-2;}' $TestFile) gawk -f subsetDisplay.awk Name=$5 Train=$Train Test=$TestSets Method=$2 Numbers=$3 Subset=$Subset Learn=$6 /tmp/effort/stats.tmp #Delete the temporary files #rm -r $Path