pred25() { cat <<EOF
telecom1,33,33,33,33,33,33,33,33,33,33,44,39,28,28,39,39,39,44,39,39,33,33,33,39,28,33,33,39,39,22,22,22,22,33,50,33,39,39,44,39,39,22,17,28,28,39,44,39,28,39,28,33,39,39,33,39,28,28,33,17,17,33,50,17,33,28,28,44,44,17,39,44,22,50,50,17,33,17,22,17,17,39,28,28,28,28,28,28,39,17
kemerer,7,7,7,7,7,7,33,33,20,20,20,27,40,20,27,20,27,20,20,20,13,13,47,20,20,27,27,20,20,20,20,33,33,40,7,40,20,7,40,7,7,47,13,7,7,13,33,13,13,27,7,40,27,33,27,27,40,0,20,7,7,27,40,13,20,33,20,13,27,27,13,27,27,7,27,33,13,20,13,20,13,7,20,20,20,20,20,20,13,7
cocomo81o,29,29,29,29,29,29,21,21,21,29,33,21,29,21,29,17,29,13,29,29,38,38,29,21,33,17,17,33,38,25,25,25,25,33,38,33,17,21,33,13,13,21,21,38,38,17,29,17,25,17,13,21,17,38,25,17,25,33,25,38,38,25,25,38,33,25,38,38,21,21,29,21,38,38,17,21,13,29,42,33,38,13,17,17,17,17,17,17,17,0
cocomo81s,9,9,9,9,9,9,9,9,9,9,18,18,0,0,9,0,9,0,0,0,9,9,0,0,9,18,18,9,9,9,9,9,9,0,9,0,0,9,0,0,0,0,0,9,9,27,0,27,0,18,18,0,9,9,18,9,0,9,18,9,9,18,0,18,0,9,9,0,18,9,9,18,0,9,18,0,0,0,9,9,0,0,9,9,9,9,9,9,0,0
desharnaisL1,39,39,39,39,39,39,41,41,43,43,41,35,43,35,37,48,37,43,39,39,30,30,41,48,39,28,28,48,46,37,37,35,35,37,33,37,48,48,39,46,46,50,33,41,41,37,26,37,35,39,30,30,35,28,39,41,43,30,26,22,22,41,30,24,37,26,24,35,28,30,39,33,39,30,39,30,20,24,22,35,20,37,24,24,24,24,24,24,24,17
desharnaisL3,20,20,20,20,20,20,20,20,20,20,40,40,40,40,40,0,40,40,40,40,20,20,20,0,30,30,30,10,10,20,20,20,20,40,30,40,0,0,30,0,0,20,30,20,20,50,40,50,40,30,60,30,50,20,30,50,10,60,40,20,20,10,20,50,20,30,30,0,20,50,40,30,30,0,0,20,0,10,20,0,10,0,20,20,20,20,20,20,0,0
albrecht,33,33,33,33,33,33,29,29,29,29,33,42,29,29,33,38,33,42,33,33,29,29,42,38,38,38,38,33,33,29,29,29,29,29,21,29,33,33,46,29,29,29,29,29,29,50,33,50,21,33,38,25,46,33,21,42,21,42,13,21,21,29,29,29,25,13,17,42,25,38,38,25,13,29,21,13,33,13,17,25,8,29,13,13,13,13,13,13,17,17
cocomo81e,18,18,18,18,18,18,14,14,14,14,4,7,14,18,18,18,18,7,7,7,7,7,11,18,14,7,7,11,7,11,11,11,11,4,14,4,18,14,4,18,18,21,4,7,7,18,4,18,21,11,11,0,11,11,11,18,11,4,14,14,14,7,4,4,11,11,11,18,7,18,18,11,4,4,7,14,4,4,0,7,18,7,11,11,11,11,11,11,11,7
nasa93_center_5,36,36,36,36,36,36,33,33,33,33,33,33,44,21,33,21,33,26,28,28,33,33,23,21,38,18,18,28,28,13,13,15,15,21,31,21,21,21,18,21,21,18,18,23,23,21,21,21,21,15,28,21,21,18,18,21,5,21,15,26,26,31,8,15,23,13,13,13,13,18,18,5,26,18,31,26,18,15,10,15,8,13,8,8,8,8,8,8,13,18
desharnaisL2,48,48,48,48,48,48,32,32,32,32,32,40,44,44,44,40,44,40,44,44,44,44,36,40,44,36,36,44,44,40,40,28,28,40,44,40,40,40,52,40,40,28,40,40,40,40,44,40,40,28,40,20,36,44,24,36,56,40,40,24,24,24,48,40,48,44,40,52,32,40,48,48,36,36,28,28,32,24,32,32,32,20,4,4,4,4,4,4,20,16
desharnais,43,43,43,43,43,43,44,44,47,47,37,32,38,46,37,38,37,43,37,37,23,23,33,38,40,28,28,38,38,43,43,36,36,31,33,31,36,36,27,36,36,32,35,38,38,37,32,37,32,35,27,33,42,31,22,42,36,26,27,17,17,36,31,30,32,35,28,35,27,30,28,30,36,30,32,28,31,30,23,22,30,30,19,19,19,19,19,19,21,15
maxwell,32,32,32,32,32,32,29,29,24,24,31,15,37,13,37,29,37,6,35,35,24,24,23,31,35,15,15,32,35,24,24,18,18,26,27,26,37,35,26,18,18,19,15,16,16,19,24,19,15,15,31,16,19,23,19,19,27,23,16,27,27,10,24,29,26,24,21,24,15,23,21,21,29,31,13,19,24,21,24,19,32,15,24,24,24,24,24,24,18,15
nasa93_center_1,58,58,58,58,58,58,58,58,58,58,42,33,33,33,25,25,25,42,17,17,58,58,25,25,25,50,50,17,33,17,17,58,58,33,25,33,25,25,33,25,25,25,33,58,58,33,33,33,50,25,33,33,33,17,33,33,25,33,25,58,58,8,42,17,17,25,17,25,25,0,0,0,8,17,33,0,33,17,0,25,8,8,0,0,0,0,0,0,0,0
sdr,42,42,42,42,42,42,42,42,38,38,17,29,29,33,8,13,8,17,13,13,13,13,46,8,8,33,33,17,17,29,29,8,8,29,8,29,8,17,21,8,8,42,25,8,8,17,33,17,46,29,17,25,17,13,29,17,33,17,17,33,33,21,4,4,4,4,17,8,33,8,8,4,13,8,25,17,25,0,0,13,0,0,8,8,8,8,8,8,0,4
finnish,61,61,61,61,61,61,61,61,34,34,66,37,42,42,47,32,47,34,50,50,42,42,32,32,34,37,37,50,47,55,55,58,58,32,34,32,32,37,18,32,32,18,26,39,39,21,24,21,32,39,39,37,21,34,34,18,21,37,42,50,50,34,42,37,37,32,34,42,34,37,26,24,29,37,29,34,29,29,32,42,37,16,18,18,18,18,18,18,16,0
miyazaki94,40,40,40,40,40,40,38,38,15,15,40,25,33,25,33,35,33,23,31,31,35,35,40,35,25,27,27,15,15,25,25,33,33,23,23,23,25,15,48,25,25,31,19,25,25,19,21,19,29,17,15,10,31,31,19,33,25,21,27,15,15,13,33,23,10,19,13,25,8,21,21,15,17,13,6,15,4,13,13,10,6,8,6,6,6,6,6,6,13,17
nasa93_center_2,43,43,43,43,43,43,41,41,35,35,59,57,11,49,27,43,27,41,38,38,14,14,14,24,35,49,49,19,19,27,27,16,16,5,46,5,49,19,14,43,43,19,11,5,5,16,8,16,8,24,41,8,16,27,30,16,14,43,32,22,22,35,8,19,14,14,22,14,16,14,11,16,5,5,14,11,22,19,5,8,14,24,11,11,11,11,11,11,22,8
cocomo81,13,13,13,13,13,13,21,21,16,16,22,16,13,14,11,11,11,13,13,13,17,17,10,6,11,14,14,8,11,17,17,11,11,8,11,8,8,10,5,8,8,10,21,22,22,11,10,11,6,10,10,8,11,6,8,11,10,11,10,11,11,25,8,11,8,5,3,10,16,8,13,8,5,3,5,14,8,2,3,5,2,6,5,5,5,5,5,5,6,6
nasa93,29,29,29,29,29,29,30,30,32,32,41,39,35,19,17,27,17,35,19,19,28,28,24,25,34,31,31,26,25,32,32,14,14,14,16,14,18,17,20,17,17,26,15,6,6,16,19,16,14,10,20,17,16,9,23,16,16,22,14,17,17,30,9,10,14,15,6,13,9,14,19,18,12,15,14,14,22,8,15,16,12,12,11,11,11,11,11,11,11,12
china,95,95,95,95,95,95,95,95,94,94,43,43,44,86,91,91,91,85,91,91,94,94,46,91,89,40,40,91,91,57,57,22,22,39,77,39,78,91,41,78,78,40,37,19,19,83,18,83,27,20,82,19,88,50,37,87,81,78,37,40,40,31,19,26,15,15,14,19,15,12,17,14,16,16,18,14,26,14,14,13,15,16,14,14,14,14,14,14,16,11
EOF
}
one11() { pred25 | gawk -F, 'NR>1 {print $1 " " $2 " " $12  " " $12 - $2 | "sort -n -k 4"}'; }
one11 > "one11.dat"

pred25sByData() { pred25 | gawk -F, 'NR>1 {SUBSEP=" "}
					NR >=2 && NR <= 6 { for(i=2;i<=NF;i++)    x5[   ++x5[0] ] = $i }
					NR >=7 && NR <= 11 { for(i=2;i<=NF;i++)    x10[   ++x10[0] ] = $i }
					NR >=12 && NR <= 16 { for(i=2;i<=NF;i++)    x15[   ++x15[0] ] = $i }
					NR >=17 && NR <= 21 { for(i=2;i<=NF;i++)    x20[   ++x20[0] ] = $i }

					  END {
					  	report(5,x5)
					  	report(10,x10)
					  	report(15,x15)
					  	report(20,x20)
				  }
function report(header,a,   div,i,f) {
	f="dall" header ".dat"
	print f
	com = " sort -n >> " f
	print "" > f
    for(i=1;i<=100; i++) 
		if (a[i] != "")
				print a[i] | com
	close(com)
}
'
}
pred25sByData
gnuplot <<EOF
set size 0.5,0.5
set terminal postscript eps color enhanced "Helvetica" 12
set output "pred25sByData.eps
set ylabel "PRED(25)"
set xlabel "all preds, sorted"
set title "Performance, grouped by data sets"
set key top left
plot "dall5.dat" title "tel,kem,coc81o,desL1,coc81s" with lines,\
	"dall10.dat" title "desL3,alb,coc81e,nasa5,desL2" with lines,\
	"dall15.dat" title "des,max,sdr,nasa1,miy94" with lines,\
	"dall20.dat" title "nasa2,fin,coc81,nasa93,china" with lines
EOF
epstopdf pred25sByData.eps


pred25s() { pred25 | gawk -F, 'NR>1 {SUBSEP=" ";
					  for(i=2;i<=9;i++)    x8[   ++x8[0] ] = $i
					  for(i=10;i<=30;i++) x30[  ++x30[0] ] = $i
					  for(i=31;i<=50;i++) x50[  ++x50[0] ] = $i
					  for(i=51;i<=70;i++) x70[  ++x70[0] ] = $i
					  for(i=71;i<=NF;i++) x100[++x100[0] ] = $i
					  }
					  END {
					  	report(8,x8)
					  	report(30,x30)
					  	report(50,x50)
					  	report(70,x70)
					  	report(100,x100)
				  }
function report(header,a,   div,i,f) {
	f="all" header ".dat"
	print f
	com = " sort -n >> " f
	print "" > f
	div = a[0]/100
    for(i=1;i<=100; i++) {
		j = int(i * div + 0.5)
		if (a[j] != "")
				print a[j] | com
	}
	close(com)
}
'
}
pred25s
gnuplot <<EOF
set size 0.5,0.5
set terminal postscript eps color enhanced "Helvetica" 12
set output "pred25s.eps
set ylabel "PRED(25)"
set xlabel "all preds, sorted"
set xrange [1:90]
set title "Performance, grouped by algorithms"
set key top left
plot "all8.dat" title "algorithms 1..8" with lines,\
	"all30.dat" title "algorithms 9..30" with lines,\
	"all50.dat" title "algorithms 31..50" with lines,\
	"all70.dat" title "algorithms 51..70" with lines,\
	"all100.dat" title "algorithms 71..90" with lines
EOF
epstopdf pred25s.eps

normalize() { cat - |	gawk 'BEGIN{FS=OFS=","} NR>1{for(i=2;i<=NF;i++) $i = int(100*$i/(89*7)); print $0}'; }
data() { cat <<EOF 
dataset,norm-CARTOn,norm-CARTOff,none-CARTOn,none-CARTOff,log-CARTOn,log-CARTOff,SWReg-CARTOn,SWReg-CARTOff,SFS-CARTOn,SFS-CARTOff,SWReg-1NN,log-1NN,SWReg-ABE0,SFS-ABE0,PCA-PLSR,SWReg-PCR,none-PLSR,SFS-1NN,PCA-PCR,none-PCR,PCA-CARTOn,PCA-CARTOff,freq5bin-ABE0,SWReg-PLSR,SFS-SLReg,norm-1NN,none-1NN,SFS-PCR,SFS-PLSR,freq5bin-CARTOn,freq5bin-CARTOff,width5bin-CARTOn,width5bin-CARTOff,norm-ABE0,PCA-SWReg,none-ABE0,SWReg-SWReg,SFS-SWReg,log-ABE0,norm-SWReg,none-SWReg,freq3bin-ABE0,PCA-ABE0,width3bin-CARTOn,width3bin-CARTOff,PCA-NNet,width3bin-ABE0,none-NNet,width5bin-SWReg,width5bin-1NN,none-SLReg,width5bin-ABE0,SFS-NNet,norm-PLSR,freq5bin-1NN,SWReg-NNet,SWReg-SLReg,norm-SLReg,freq3bin-1NN,freq3bin-CARTOn,freq3bin-CARTOff,PCA-1NN,width3bin-SWReg,width5bin-PLSR,log-SWReg,log-PCR,log-PLSR,width3bin-PLSR,width3bin-1NN,width5bin-PCR,norm-PCR,width3bin-PCR,freq5bin-PCR,freq5bin-SWReg,width3bin-SLReg,freq3bin-PCR,width5bin-SLReg,freq3bin-PLSR,freq5bin-PLSR,log-SLReg,freq3bin-SWReg,freq5bin-SLReg,width5bin-NNet,norm-NNet,width3bin-NNet,log-NNet,freq3bin-NNet,freq5bin-NNet,freq3bin-SLReg,PCA-SLReg
telecom1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,44,0,50,50,0,0,0,0,0,0,0,0,0,0,0,0,2,0,27,0,27,0,0,56,1,0,0,0,0,0,0,0,225
kemerer,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,5,5,0,0,0,20,0,0,61,0,63,63,0,3,2,2,4,0,4,2,0,4,0,1,0,0,0,0,128,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,8,0,0,10,0,1,67,23,148,1,1,1,1,1,1,5,193
cocomo81o,0,0,0,0,0,0,69,69,0,0,0,21,0,0,0,2,0,1,2,2,1,1,0,1,2,54,54,2,0,0,0,0,0,0,0,0,26,4,0,62,62,0,16,0,0,24,0,24,0,28,233,0,24,0,0,24,2,29,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,6,254,0,315,2,0,7,0,70,26,26,25,25,26,26,44,666
cocomo81s,5,5,5,5,5,5,5,5,2,2,0,2,75,5,11,15,11,29,105,106,5,5,24,15,68,5,6,26,26,17,17,5,5,21,87,23,31,82,13,26,27,26,3,5,5,2,14,2,48,12,14,28,83,51,1,82,151,54,1,5,5,0,4,43,44,95,93,58,14,23,63,1,82,93,17,53,348,115,100,5,126,161,78,79,79,83,79,79,240,454
desharnaisL1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,3,3,0,0,0,6,6,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,5,35,5,2,0,12,0,17,0,0,0,0,12,111,279,279,0,0,91,0,1,12,0,109,1,0,0,13,0,0,0,49,14,116,5,353,91,311,311,312,311,311,312,301,648
desharnaisL3,39,39,39,39,39,39,39,39,39,39,1,0,1,1,9,38,9,1,13,13,39,39,0,38,6,0,0,14,13,39,39,39,39,0,6,0,74,79,0,92,92,0,6,39,39,0,0,0,2,0,0,0,0,12,0,0,27,0,0,39,39,21,1,2,0,0,0,257,12,0,0,0,12,231,315,20,404,101,52,485,44,645,39,39,41,41,41,47,624,604
albrecht,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,2,2,0,0,0,27,0,0,0,0,1,1,1,3,0,0,0,0,0,0,0,0,2,0,0,1,0,33,0,183,54,54,31,0,0,12,132,113,0,2,0,0,0,231,0,77,390,3,186,108,16,529,53,419,423,425,423,423,419,403,475
cocomo81e,0,0,0,0,0,0,6,6,8,8,30,25,7,0,14,2,14,19,40,42,13,13,15,2,3,21,23,54,65,19,19,2,2,29,39,36,11,6,34,14,14,0,32,59,59,7,48,7,5,14,160,55,152,116,13,7,36,288,3,14,14,14,264,139,51,134,97,56,27,56,54,155,141,130,41,118,239,149,244,211,19,282,152,152,153,155,155,153,227,396
nasa93_{center5},0,0,0,0,0,0,0,0,0,0,0,0,0,41,0,4,0,0,2,2,0,0,15,4,57,13,13,1,0,58,58,15,15,8,0,8,4,4,32,4,4,47,36,3,3,65,11,65,5,81,0,6,65,93,14,65,317,16,29,18,18,0,276,117,0,85,101,239,190,91,19,137,15,101,7,5,64,136,123,325,402,273,355,351,351,351,351,355,339,431
desharnaisL2,0,0,0,0,0,0,1,1,1,1,9,39,0,0,0,0,0,0,0,0,0,0,0,0,0,12,12,0,0,0,0,3,3,1,22,1,0,0,0,0,0,132,0,0,0,0,0,0,0,145,1,115,0,0,320,0,0,0,206,272,272,249,0,0,0,0,0,0,135,0,0,0,109,20,7,4,7,146,159,29,10,319,579,579,579,579,580,580,492,566
desharnais,0,0,0,0,0,0,0,0,0,0,0,22,0,0,0,0,0,1,0,0,426,426,46,0,35,114,114,0,0,0,0,0,0,0,0,0,0,0,71,0,0,40,0,0,0,26,51,26,37,2,0,23,0,22,388,0,12,23,281,344,344,81,3,75,40,0,56,0,225,17,124,159,2,72,130,81,70,87,70,106,80,65,522,522,522,522,522,522,306,663
maxwell,1,1,1,1,1,1,0,0,3,3,6,81,1,184,5,59,5,229,1,1,3,3,33,32,1,136,136,5,5,19,19,132,132,95,36,95,78,7,77,104,105,107,388,249,249,71,65,72,247,121,68,160,71,87,111,71,43,110,250,35,35,381,79,33,91,71,110,42,227,82,244,192,69,60,396,324,201,86,73,238,58,439,304,304,304,308,308,306,445,615
nasa93_{center1},0,0,0,0,0,0,0,0,0,0,0,0,0,6,2,0,2,0,0,5,0,0,6,0,0,14,14,0,0,381,381,0,0,18,1,18,0,0,18,0,0,169,0,0,0,0,111,0,0,64,54,111,0,132,116,0,0,54,0,0,0,306,0,36,0,0,35,116,64,449,464,464,449,403,0,484,0,319,454,156,330,402,461,461,461,461,461,461,560,550
sdr,3,3,3,3,7,7,4,4,1,1,21,3,41,5,237,168,237,7,185,187,25,25,34,179,274,28,28,78,78,15,15,65,65,5,140,5,163,92,3,175,176,54,6,58,58,72,27,73,12,8,320,3,72,155,4,72,0,356,9,8,8,5,355,225,170,163,72,251,43,185,183,204,175,333,13,158,154,398,326,153,339,567,175,176,176,170,175,176,569,561
finnish,0,0,0,0,0,0,0,0,155,155,0,66,30,100,1,109,1,94,3,3,117,117,96,109,119,88,88,1,1,0,0,0,0,125,113,125,109,117,316,109,109,197,137,78,78,413,168,413,140,36,103,97,413,104,87,585,561,103,91,0,0,106,47,108,127,119,119,94,128,123,185,232,118,90,284,95,137,96,100,85,98,579,585,585,585,586,585,585,472,666
miyazaki94,19,19,19,19,20,20,18,18,102,102,1,61,3,64,0,14,0,116,0,0,21,21,0,8,135,28,28,302,302,59,59,15,15,5,46,6,27,302,7,26,26,1,122,14,14,96,119,97,53,187,83,188,25,24,107,34,9,96,54,219,219,256,4,85,533,339,496,109,421,200,105,228,392,462,566,395,655,428,449,489,521,465,455,457,455,455,457,457,407,363
nasa93_center_2,0,0,0,0,0,0,0,0,5,5,51,1,183,12,38,7,38,23,13,13,52,52,194,137,0,31,31,137,137,80,80,166,166,237,65,240,72,137,188,65,65,225,231,300,300,212,285,212,187,175,64,258,212,88,94,212,169,67,96,115,115,48,221,192,182,226,192,231,254,340,364,362,433,476,283,376,177,270,297,224,325,216,442,442,442,442,442,442,316,638
cocomo81,21,21,22,22,21,21,19,19,26,26,4,2,10,2,154,92,156,6,133,139,139,139,35,177,154,62,63,181,151,39,39,56,56,100,192,107,308,142,104,309,312,26,6,11,11,160,106,162,300,53,328,111,160,292,113,160,168,304,87,36,36,41,206,302,365,323,327,343,12,355,288,345,409,367,416,345,365,356,367,402,458,427,395,395,395,396,395,395,427,402
nasa93,15,15,15,15,15,15,12,12,6,6,8,27,8,129,167,124,167,35,156,156,14,14,116,118,8,30,30,104,134,17,17,162,162,190,203,195,202,202,137,202,202,84,175,241,241,238,153,238,233,339,145,181,238,276,87,238,212,65,158,153,153,47,350,424,290,305,313,454,361,292,270,330,386,282,362,344,195,413,290,267,395,287,489,489,489,489,489,487,392,511
china,46,46,46,46,46,46,53,53,52,52,281,284,282,178,94,98,94,177,94,94,30,30,293,97,65,287,287,89,87,280,280,408,408,289,130,289,126,34,284,123,123,306,329,473,473,273,478,273,409,462,114,438,250,336,353,268,111,127,382,304,304,375,474,412,481,522,527,475,500,596,490,604,492,491,479,518,409,493,500,601,490,490,617,619,619,619,619,619,496,625
EOF
}

get() {
	data | normalize |  
	gawk -F, '{OFS="\t"; for(i=2;i<=NF;i++) 
			if ($i < Max && $i >= Min) print NR,i }' Max=$2 Min=$1
}
cols() { data | gawk -F, 'NR> 1{OFS="\t"; sum=0; for(i=2;i<=NF;i++) sum += $i; print $1,sum*100/(89*7*90)}'; }
rows() { data | gawk -F, 'NR> 1{OFS="\t";  for(i=2;i<=NF;i++) sum[i] += $i} END{
                            for(i=2;i<=NF;i++) print sum[i]*100/(89*7*20) }'; }
names() { data | gawk -F, 'NR==1 {SUBSEP=" ";
					  for(i=2;i<=9;i++) mark(8,$i) 
					  for(i=10;i<=30;i++) mark(30,$i) 
					  for(i=31;i<=50;i++) mark(50,$i) 
					  for(i=51;i<=70;i++) mark(70,$i) 
					  for(i=71;i<=NF;i++) mark(90,$i) 
					  }
					  END {
					  	report("learners",ls,lsall)
					  	report("preps",ps,psall)
				  }
function report(header,all,m) {
	print header
	OFS="   "
		com = "sort   -k 1,2"
	for(key in keys)
		for(one in all) {
			n =  ( (key,one) in m) ? m[key,one] : 0
			print one,key,n | com
		}
	close(com)
}
function mark(key,str,  l,p,tmp) {
	split(str,tmp,/-/)
	l = tmp[2]
	p = tmp[1]
	ls[l]
	ps[p]
	keys[key]
	psall[key,p]++
	lsall[key,l]++
}'
}
names | tee   names.out

cols | cat -n >  cols.dat
rows | cat -n >  rows.dat
get 0 12.5 >  5.dat
get 12.5 25 >  25.dat
get 25 50 >  50.dat
get 50 100 >  100.dat

gnuplot<<EOF
set size 0.5,0.5
set terminal postscript eps color enhanced "Helvetica" 12
set output "rows.eps
set nokey
set xrange [0:95]
set xlabel "methods, sorted by number of losses"
set ylabel "percentage of losses"
plot "rows.dat" with lines
EOF
epstopdf rows.eps

gnuplot<<EOF
set size 0.5,0.5
set terminal postscript eps color enhanced "Helvetica" 12
set output "cols.eps
set xtics rotate by -60 ("telecom" 1,"kemerer" 2,"cocomo81o" 3, "desharnaisL1" 4, "cocomo81s" 5, "desharnaisL3" 6, "albrecht" 7, "cocomo81e" 8, "nasa93_{center5}" 9, "desharnaaisL2" 10, "desharnais" 11, "maxwell" 12, "sdr" 13, "nasa93_{center1}" 14, "miyazaki94" 15, "nasa93_{center2}" 16, "finnish" 17, "cocomo81" 18, "nasa93" 19, "china" 20)
set nokey
set arrow 1 from 11,0 to 11,15 nohead ls 0
set arrow 2 from 0,15 to 11,15 nohead ls 0
## set title "total number of losses"
set ylabel "percentage of losses"
set xrange [0:21]
plot "cols.dat" using 1:3 with lines
EOF
epstopdf cols.eps

gnuplot<<EOF
set pointsize 1.5
set size 0.5,1
set terminal postscript eps color enhanced "Helvetica" 12
set output "thinks.eps
set xrange [0:21]
set yrange [0:110]
set ytics (8,30,50,70,"90" 91 )
#set noytics #(  "f" 10, "f" 11,  "f" 19, "f" 22,  "L, f" 28, "f" 32, "f" 33,  "f" 39, "f" 51,  "L"  53, "L" 54, "L" 57,   "L" 72,"L" 76, "L" 80,  "L" 82, "L" 89)

set xtics rotate by -60 ("telecom" 1,"kemerer" 2,"cocomo81o" 3, "desharnaisL1" 4, "cocomo81s" 5, "desharnaisL3" 6, "albrecht" 7, "cocomo81e" 8, "nasa93_{center5}" 9, "desharnaaisL2" 10, "desharnais" 11, "maxwell" 12, "sdr" 13, "nasa93_{center1}" 14, "miyazaki94" 15, "nasa93_{center2}" 16, "finnish" 17, "cocomo81" 18, "nasa93" 19, "china" 20)

set ylabel "90 algorithms, sorted by losses in all data sets"
set arrow 1 from 0,8 to 20,8 nohead
set arrow 2 from 0,30 to 20,30 nohead
set arrow 3 from 0,50 to 20,50 nohead
set arrow 4 from 0,70 to 20,70 nohead
set arrow 5 from 0,80 to 21,80 nohead
set arrow 6 from 0,12 to 21,12 nohead
set label "log\nLReg" at -2.5,81
set label "log ABE0\n1NN" at -4.5,12
plot "5.dat" title "< 12.5% losses" with points  6 5,\
	"25.dat" title "< 25.0% losses" with points  5 5,\
	"50.dat" title "< 50.0% losses" with points  8 5,\
	"100.dat" title ">= 50.0% losses" with points 7 5 
EOF
epstopdf thinks.eps

cd ..; pdflatex order
