#! /bin/bash Path="/tmp/$USER" Filename=$1 Learner="attrLC" RankingFile="rank.tmp" RankerLogFile=$Path"/cocomin_ranking.log" TargetBase="-" EMstart=1 FieldCount=$(gawk 'BEGIN{FS=","}NR==1{print NF}' $Filename) ((EMend=FieldCount-2)) for ((i=$EMstart;i<=$EMend;i++)) do TargetEMs=$TargetBase$i- LogFile=$RankerLogFile".ranking."$i gawk -f lc.awk Pass=1 TargetEMs=$TargetEMs $Filename Pass=2 TargetEMs=$TargetEMs $Filename > $LogFile Stats=$(./calc $LogFile) #Calculate Standard Deviation of Attribute AttrDev=$(gawk -f columnstdev.awk Columns=$TargetEMs $Filename) #Calculate Entropy of Attribute (using discrete formula because the effort multipliers are discrete) AttrEntropy=$(gawk -f columnentropy.awk Columns=$TargetEMs $Filename) AvgCorr=$(echo $Stats | gawk 'BEGIN{FS=","} NR==1{print $4}') echo $TargetEMs","$AvgCorr","$AttrDev","$AttrEntropy done > $RankingFile sort -t, -nrk2 $RankingFile | gawk -F, '{print $1}' | gawk 'BEGIN{FS="-"}{print $2-1}' > "cor_hi" sort -t, -nrk3 $RankingFile | gawk -F, '{print $1}' | gawk 'BEGIN{FS="-"}{print $2-1}' > "var_hi" sort -t, -nrk4 $RankingFile | gawk -F, '{print $1}' | gawk 'BEGIN{FS="-"}{print $2-1}' > "ent_hi" sort -t, -nk2 $RankingFile | gawk -F, '{print $1}' | gawk 'BEGIN{FS="-"}{print $2-1}' > "cor_lo" sort -t, -nk3 $RankingFile | gawk -F, '{print $1}' | gawk 'BEGIN{FS="-"}{print $2-1}' > "var_lo" sort -t, -nk4 $RankingFile | gawk -F, '{print $1}' | gawk 'BEGIN{FS="-"}{print $2-1}' > "ent_lo"