#! /bin/bash #rm -r log/recordGraphs #mkdir log/recordGraphs #grep LC nfoldCocomostExperimentSep28.csv | gawk 'BEGIN{FS=OFS=","}{print $1,$2,$NF}' Learner="LC" MakeSubsets=1 DataPath="data/subsets" if ((MakeSubsets==1)) then rm -r $DataPath mkdir -p $DataPath #cp data/coc81modetypelangtype.csv $DataPath"/coc81_all.csv" cp data/mod_nasa93.csv $DataPath"/nasa93_all.csv" #Make the subsets of coc81 data #gawk -f csvsubset.awk Col="kind" Want="min" data/coc81modetypelangtype.csv > $DataPath"/coc81_kind_min.csv" #gawk -f csvsubset.awk Col="lang" Want="ftn" data/coc81modetypelangtype.csv > $DataPath"/coc81_lang_ftn.csv" #gawk -f csvsubset.awk Col="mode" Want="e" data/coc81modetypelangtype.csv > $DataPath"/coc81_mode_e.csv" #gawk -f csvsubset.awk Col="kind" Want="max" data/coc81modetypelangtype.csv > $DataPath"/coc81_kind_max.csv" #gawk -f csvsubset.awk Col="mode" Want="org" data/coc81modetypelangtype.csv > $DataPath"/coc81_mode_org.csv" #gawk -f csvsubset.awk Col="lang" Want="mol" data/coc81modetypelangtype.csv > $DataPath"/coc81_lang_mol.csv" #Make the subsets of nasa93 data gawk -f csvsubset.awk Col="projectname" Want="gro" data/nasa93.csv > $DataPath"/nasa93_project_gro.csv" gawk -f csvsubset.awk Col="cat2" Want="missionplanning" data/nasa93.csv > $DataPath"/nasa93_cat2_missionplanning.csv" gawk -f csvsubset.awk Col="cat2" Want="avionicsmonitoring" data/nasa93.csv > $DataPath"/nasa93_cat2_avionicsmonitoring.csv" gawk -f csvsubset.awk Col="mode" Want="semidetached" data/nasa93.csv > $DataPath"/nasa93_mode_semidetached.csv" gawk -f csvsubset.awk Col="projectname" Want="sts" data/nasa93.csv > $DataPath"/nasa93_project_sts.csv" gawk -f csvsubset.awk Col="forg" Want="g" data/nasa93.csv > $DataPath"/nasa93_forg_g.csv" gawk -f csvsubset.awk Col="center" Want="5" data/nasa93.csv > $DataPath"/nasa93_center_5.csv" gawk -f csvsubset.awk Col="year" Want="1975" data/nasa93.csv > $DataPath"/nasa93_year_1975.csv" gawk -f csvsubset.awk Col="year" Want="1980" data/nasa93.csv > $DataPath"/nasa93_year_1980.csv" gawk -f csvsubset.awk Col="mode" Want="embedded" data/nasa93.csv > $DataPath"/nasa93_mode_embedded.csv" gawk -f csvsubset.awk Col="center" Want="2" data/nasa93.csv > $DataPath"/nasa93_center_2.csv" fi Experiment="log/nfoldCocomostExperimentSep28.csv" #Coc81Subsets="coc81_all.csv coc81_kind_min.csv coc81_lang_ftn.csv coc81_mode_e.csv coc81_kind_max.csv coc81_mode_org.csv coc81_lang_mol.csv" Nasa93Subsets="nasa93_all.csv nasa93_project_gro.csv nasa93_cat2_missionplanning.csv nasa93_cat2_avionicsmonitoring.csv nasa93_mode_semidetached.csv nasa93_project_sts.csv nasa93_forg_g.csv nasa93_center_5.csv nasa93_year_1975.csv nasa93_year_1980.csv nasa93_mode_embedded.csv nasa93_center_2.csv" #AllSubsets=$Coc81Subsets" "$Nasa93Subsets # Isolate the mre's of learner on the subset #for Learner in $Learners #do function plot { echo "#record,nasa93_all,nasa93_project_gro,nasa93_cat2_missionplanning,nasa93_cat2_avionicsmonitoring,nasa93_mode_semidetached,nasa93_project_sts,nasa93_forg_g,nasa93_center_5,nasa93_year_1975,nasa93_year_1980,nasa93_mode_embedded,nasa93_center_2,average" for ((I=1;I<=93;I++)) do echo -n $I"," for Subset in $Nasa93Subsets do #The purpose of the Converter is to match the subsets record numbers Converter="-"$(gawk 'BEGIN{FS=","}NR<=2{next}{printf("%d-",$1);}' $DataPath"/"$Subset) grep $Learner $Experiment | grep $Subset | gawk 'BEGIN{FS=OFS=","}{print $NF}' | gawk -F, -v Converter=$Converter -v I=$I ' {Data[NR]=$1} END{ Rec=1 for(X=1;X<=93;X++) { targ="-"X"-"; #targ="-"I"-"; #print "targ is "targ if (index(Converter, targ)!=0) { #print Data[Rec] if (X==I) { printf("%.2f,",Data[Rec]); } Rec++; } else { if (X==I) { printf("NA,"); } #print "NA" } } } ' #' > "/tmp/"$Learner"_"$Subset done echo "" done } plot | gawk ' BEGIN{ FS=OFS=","} NR==1{print $0;next;} { count=0; sum=0.0; for(i=2;i<=(NF-1);i++) { if ($i!="NA") {count++;sum+=$i} } $NF=sum/count; print $0 } '