#! /bin/bash # Aggregate Files are: # Method,Ties,Wins,Losses,Wins-Losses,MMRE,MedianMRE,Pred30,Correlation # LINES is the max number of data lines put in each table LINES=60 function break_up_data { my_file=$1 rm *.tmp #grep -v Wins-Losses $my_file | sort -t, -r -nk5 | gawk -v x=$LINES 'BEGIN{i=1}{i=(int((NR-1)/x)+1);print $0>>i".tmp"}' grep -v Wins-Losses $my_file | sort -t, -nk1 | gawk -v x=$LINES 'BEGIN{i=1}{i=(int((NR-1)/x)+1);print $0>>i".tmp"}' # print the number of breaks made n=$(grep -v Wins-Losses $my_file | gawk -v x=$LINES 'END{print int((NR-1)/x)+1}') echo $n } function print_table_front { echo "\clearpage" echo "\begin{table}[htbp]" echo "\begin{center}" echo "\scriptsize{" echo "\begin{tabular}{|r|r|r|r|r|r|r|r|r|}" echo "\hline" #echo -n "Method&Ties&Wins&Losses&Wins-Losses&MMRE&MedianMRE&Pred30&Correlation\\" echo -n "Method&Ties&Wins&Losses&Win-Loss&MMRE&MedMRE&Pred30&R\\" echo "\\" echo "\hline" } function print_table_end { my_fig=$1 my_i=$2 total=$3 echo "\hline" echo "\end{tabular}" echo "}" echo "\end{center}" Caption=$(gawk -v i=$my_i -v f=$my_fig -v n=$total 'BEGIN{if (n==1){print f}else{print f" (pg "i" of "n")"}}') # replace - with space (maybe this will look better, maybe not) #Caption=$(echo $Caption | sed -e 's/-/ /g') echo "\caption{"$Caption"}\label{"$my_fig"-"$my_i"}" echo "\end{table}" echo "" } function make_table { file=$1 fig=$2 echo "STATUS - making a table of "$1" and calling it "$2 num_breaks=$(break_up_data $file) { for ((i=1;i<=$num_breaks;i++)) do print_table_front # sort by wins-losses #grep -v Wins-Losses $file | #sed -e 's/_/:/g' $i".tmp" | #sort -t, -r -nk5 | #sed -e 's/_/:/g' $i".tmp" | cat $i".tmp" | gawk 'BEGIN{FS=","}{printf("%s&%s&%s&%s&%s&%s&%s&%s&%s%s%s\n",$1,$2,$3,$4,$5,$6,$7,$8,$9,"\\","\\");}' # just remember to replace _ with \_ using the text editor print_table_end $fig $i $num_breaks done } > "tables/"$fig".tex" } #make_table bagging/experiment1/results/all_aggregate.csv Results-Bagging-Experiment-1-All-Datasets #make_table bagging/experiment1/results/coc81_aggregate.csv Results-Bagging-Experiment-1-Coc81-Datasets #make_table bagging/experiment1/results/nasa93_aggregate.csv Results-Bagging-Experiment-1-Nasa93-Datasets #make_table bagging/experiment2/results/all_aggregate.csv Results-Bagging-Experiment-2-All-Datasets #make_table bagging/experiment2/results/coc81_aggregate.csv Results-Bagging-Experiment-2-Coc81-Datasets #make_table bagging/experiment2/results/nasa93_aggregate.csv Results-Bagging-Experiment-2-Nasa93-Datasets #make_table bagging/cocomonsterV1/results/all_aggregate.csv Results-Bagging-Cocomonster-All-Datasets #make_table bagging/cocomonsterV1/results/coc81_aggregate.csv Results-Bagging-Cocomonster-Coc81-Datasets #make_table bagging/cocomonsterV1/results/nasa93_aggregate.csv Results-Bagging-Cocomonster-Nasa93-Datasets #make_table boosting/adaboost/results1/all_aggregate.csv Results-Boosting-Adaboost-Experiment-1-All-Datasets #make_table boosting/adaboost/results1/coc81_aggregate.csv Results-Boosting-Adaboost-Experiment-1-Coc81-Datasets #make_table boosting/adaboost/results1/nasa93_aggregate.csv Results-Boosting-Adaboost-Experiment-1-Nasa93-Datasets #make_table boosting/adaboost/results2/all_aggregate.csv Results-Boosting-Adaboost-Experiment-2-All-Datasets #make_table boosting/adaboost/results2/coc81_aggregate.csv Results-Boosting-Adaboost-Experiment-2-Coc81-Datasets #make_table boosting/adaboost/results2/nasa93_aggregate.csv Results-Boosting-Adaboost-Experiment-2-Nasa93-Datasets #make_table boosting/subsampling/results/all_aggregate.csv Results-Boosting-Subsampling-All-Datasets #make_table boosting/subsampling/results/coc81_aggregate.csv Results-Boosting-Subsampling-Coc81-Datasets #make_table boosting/subsampling/results/nasa93_aggregate.csv Results-Boosting-Subsampling-Nasa93-Datasets #make_table boosting/oversample/results1/all_aggregate.csv Results-Boosting-Oversampling-Experiment-1-All-Datasets #make_table boosting/oversample/results1/coc81_aggregate.csv Results-Boosting-Oversample1-Coc81-Datasets #make_table boosting/oversample/results1/nasa93_aggregate.csv Results-Boosting-Oversample1-Nasa93-Datasets #make_table boosting/oversample/results2/all_aggregate.csv Results-Boosting-Oversampling-Experiment-2-All-Datasets #make_table boosting/oversample/results2/coc81_aggregate.csv Results-Boosting-Oversampling-Experiment-2-Coc81-Datasets #make_table boosting/oversample/results2/nasa93_aggregate.csv Results-Boosting-Oversampling-Experiment-2-Nasa93-Datasets #make_table boosting/oversample/results3/all_aggregate.csv Results-Boosting-Oversampling-Experiment-3-All-Datasets #make_table boosting/oversample/results3/coc81_aggregate.csv Results-Boosting-Oversampling-Experiment-3-Coc81-Datasets #make_table boosting/oversample/results3/nasa93_aggregate.csv Results-Boosting-Oversampling-Experiment-3-Nasa93-Datasets #make_table boosting/oversample/results4_march7/all_aggregate.csv Results-Boosting-Oversampling-Experiment-4-All-Datasets #make_table boosting/oversample/results4_march7/coc81_aggregate.csv Results-Boosting-Oversampling-Experiment-4-Coc81-Datasets #make_table boosting/oversample/results4_march7/nasa93_aggregate.csv Results-Boosting-Oversampling-Experiment-4-Nasa93-Datasets #make_table cocomost/new_results/all_aggregate.csv Results-FSS-Cocomost-All-Datasets #make_table cocomost/new_results/coc81_aggregate.csv Results-FSS-Cocomost-Coc81-Datasets #make_table cocomost/new_results/nasa93_aggregate.csv Results-FSS-Cocomost-Nasa93-Datasets #make_table dBFS/results/all_aggregate.csv Results-FSS-dBFS-All-Datasets #make_table dBFS/results/coc81_aggregate.csv Results-FSS-dBFS-Coc81-Datasets #make_table dBFS/results/nasa93_aggregate.csv Results-FSS-dBFS-Nasa93-Datasets #make_table experiment_cocomin81/results/all_aggregate.csv Results-FSS-Cocomin-All-Datasets #make_table experiment_cocomin81/results/coc81_aggregate.csv Results-FSS-Cocomin-Coc81-Datasets #make_table experiment_cocomin81/results/nasa93_aggregate.csv Results-FSS-Cocomin-Nasa93-Datasets #make_table jpl_experiment_results/2CEE_all.csv Results-JPL-Experiment-All-Records #make_table jpl_experiment_results/2CEE_flight.csv Results-JPL-Experiment-Flight-Records #make_table jpl_experiment_results/2CEE_ground.csv Results-JPL-Experiment-Ground-Records #make_table jpl_experiment_results/2CEE_flight_withoutFSWCM.csv Results-JPL-Experiment-Flight-Records make_table fss/results/all_aggregate.csv Results-FSS-All-Records make_table fss/results/coc81_aggregate.csv Results-FSS-Coc81-Records make_table fss/results/nasa93_aggregate.csv Results-FSS-Nasa93-Records rm *.tmp