#! /bin/bash # This version assumes the attributes have already been ranked and saved to $RankingFile # Make it use: $Search $Horizon # EffortResult needs to be saved to a file also. # Arguments # ./attr $Filename $Path $Ranker $TestFile $TrainFile $LogFile $Horizon $RankingFile $SortingFile $Eval $Search # TestFile=/tmp/learners/data/test/coc81_kind_min.csv.numeric.1 # TrainFile=/tmp/learners/data/train/coc81_kind_min.csv.numeric.1 # ./attr coc81_kind_min.csv /tmp/learners correlation $TestFile $TrainFile /tmp/debug.log 0 /tmp/debug.rank /tmp/debug.sort mmre forward Filename=$1 Path=$2 Ranker=$3 TestFile=$4 TrainFile=$5 LogFile=$6 Horizon=$7 RankingFile=$8 SortingFile=$9 Eval=${10} Search=${11} EMstart=1 EMend=15 #echo $Filename, $Path, $Ranker, $TestFile, $TrainFile, $LogFile, $Horizon, $RankingFile, $SortingFile, $Eval, $Search > /tmp/debug.tmp #echo "arguments:" > /tmp/debug.tmp #echo $1 >> /tmp/debug.tmp #echo $2 >> /tmp/debug.tmp #echo $3 >> /tmp/debug.tmp #echo $4 >> /tmp/debug.tmp #echo $5 >> /tmp/debug.tmp #echo $6 >> /tmp/debug.tmp #echo $7 >> /tmp/debug.tmp #echo $8 >> /tmp/debug.tmp #echo $9 >> /tmp/debug.tmp #echo ${10} >> /tmp/debug.tmp #echo ${12} >> /tmp/debug.tmp #echo "end of arguments." >> /tmp/debug.tmp # Set up the Ranking criteria for evaluating attributes if [ $Ranker = "correlation" ] then SortColumn=2 Reverse=1 fi if [ $Ranker = "variance_high" ] then SortColumn=3 Reverse=1 fi if [ $Ranker = "variance_low" ] then SortColumn=3 Reverse=0 fi if [ $Ranker = "entropy_high" ] then SortColumn=4 Reverse=1 fi if [ $Ranker = "entropy_low" ] then SortColumn=4 Reverse=0 fi # Set up the Evaluation criteria for finding improvement #echo "got here and $Eval is " $Eval >> /tmp/debug.tmp if [ $Eval = "mmre" ] then EvalColumn=1 EvalDef=1 fi if [ $Eval = "sd_mre" ] then EvalColumn=2 EvalDef=1 fi if [ $Eval = "pred30" ] then EvalColumn=3 EvalDef=0 fi if [ $Eval = "correlation" ] then EvalColumn=4 EvalDef=0 fi if (($EvalDef==1)) then NewValue=99999 else NewValue=-99999 fi #RankingFile=$Path"/attribute_ranking.tmp" #SortingFile=$Path"/attribute_sorting.tmp" # Rank Attributes #./attr_ranking $Filename $Path "attrLC" $TestFile $TrainFile "-" $LogFile $EMstart $EMend > $RankingFile # Try Combinations of Effort Multipliers #Column, Correlation, Variance, Entropy #sort +$SortColumn -n -r $RankingFile > $SortingFile if ((Reverse==1)) then sort -t, -nrk$SortColumn $RankingFile > $SortingFile else sort -t, -nk$SortColumn $RankingFile > $SortingFile fi #Mmre, Sd, Pred30, Columns #echo $NewValue, $EvalDef, $Reverse, $EvalColumn, $SortColumn >> /tmp/debug.tmp Subset="" i=$EMstart while ((i<=EMend)) do #Subset+=$(gawk -v x=$i 'NR==x{print $1}' "/tmp/sort_results.dat") NewSubset=$Subset$(gawk -v x=$i 'BEGIN{FS=","} NR==x{print $1}' $SortingFile) #echo "Subset is " $Subset >> /tmp/subset.tmp #echo "NewSubset is " $NewSubset >> /tmp/subset.tmp # Try Local Calibration using the Subset. EffortResult=$(./effort $Filename $Path "simpleLC" $TestFile $TrainFile $NewSubset $LogFile"."$i) OldValue=$NewValue #NewValue=$(echo $EffortResult | gawk 'BEGIN{FS=","} {print $1}') NewValue=$(echo $EffortResult | gawk -v EvalColumn=$EvalColumn 'BEGIN{FS=","} {print $EvalColumn}') # Test new MMRE and handle Subset Selection #Keep=$(gawk -v a=$NewValue -v b=$OldValue 'BEGIN{if (a "/tmp/arguments.tmp" #echo "hmmm" >> "/tmp/arguments.tmp" #echo $Filename >> "/tmp/arguments.tmp" #echo $Path >> "/tmp/arguments.tmp" #echo "simpleLC" >> "/tmp/arguments.tmp" #echo $TestFile >> "/tmp/arguments.tmp" #echo $TrainFile >> "/tmp/arguments.tmp" #echo $Subset >> "/tmp/arguments.tmp" #echo $LogFile".final" >> "/tmp/arguments.tmp"