#! /bin/bash # TO DO # move cocomost folder to sandbox and make a cleaner version for the main # make it work for a set of learners # move gnuplot stuff to a function or a script so it can be used in a loop # fix gnuplot use of some variables such as $Learner # include code for cocomost and include in graphs # include mmre as a label or something on the graphs for each learner # duplicate code for nasa93 and make sure nothing is hardcoded (use more variables and make sure to set them) rm -r log/recordGraphs mkdir log/recordGraphs #grep LC nfoldCocomostExperimentSep28.csv | gawk 'BEGIN{FS=OFS=","}{print $1,$2,$NF}' 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/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 Learner="LC" Learners="LC cocomost" 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 for Subset in $AllSubsets do 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 ' {Data[NR]=$1} END{ Rec=1 for(X=1;X<=63;X++) { targ="-"X"-"; if (index(Converter, targ)!=0) { print Data[Rec] Rec++; } else { print "NA" } } } ' > "/tmp/"$Learner"_"$Subset done done TmpFile1="/tmp/mre_list.1" TmpFile2="/tmp/mre_list.2" # First handle COC81 # Now make a graph of the mre's of each record for ((i=1;i<=63;i++)) do OutFile="log/recordGraphs/coc81_"$Learner"_"$i".pdf" Title="coc81_record_#"$i # Get a list of the mre's for the record echo -n "" > $TmpFile1 echo -n "" > $TmpFile2 # Generate the graph input for LC count=1; for Subset in $Coc81Subsets do gawk -v I=$i -v Count=$count 'NR==I{if($0!="NA"){printf("%d %f\n",Count,$0);}}' "/tmp/LC_"$Subset >> $TmpFile1 ((count++)) done # Generate the graph input for cocomost count=1; for Subset in $Coc81Subsets do gawk -v I=$i -v Count=$count 'NR==I{if($0!="NA"){printf("%d %f\n",Count,$0);}}' "/tmp/cocomost_"$Subset >> $TmpFile2 ((count++)) done ./plotMRE $Title $OutFile $TmpFile1 $TmpFile2 done