From: Aaron A. <aa...@us...> - 2007-07-10 01:38:43
|
Update of /cvsroot/jboost/jboost/scripts In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv23831/scripts Modified Files: atree2dot2ps.pl nfold.py Log Message: added 'truncate' and 'flip label' options Index: atree2dot2ps.pl =================================================================== RCS file: /cvsroot/jboost/jboost/scripts/atree2dot2ps.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** atree2dot2ps.pl 19 May 2007 21:42:41 -0000 1.3 --- atree2dot2ps.pl 10 Jul 2007 01:38:38 -0000 1.4 *************** *** 16,24 **** print "\t -t (--tree) file.tree \t File containing the ADTree in text format (required) \n"; print "\t -d (--dir) directiory\t Directory to use (optional, defaults to '.') \n"; print "\t --threshold num \t A given depth to stop the tree from becoming too large. (optional) \n"; print "\t -h (--help) \t Print this usage information \n"; print "\n"; print "This script uses the 'dot' program, which must be in your path.\n"; ! print "'dot' is part of the graphviz package from at&t research.\n"; exit($exit_code); } --- 16,26 ---- print "\t -t (--tree) file.tree \t File containing the ADTree in text format (required) \n"; print "\t -d (--dir) directiory\t Directory to use (optional, defaults to '.') \n"; + print "\t -l (--labels) \t Flip the labels (-1 becomes +1) (optional)\n"; + print "\t --truncate \t Truncate threshold values to increase readability\n"; print "\t --threshold num \t A given depth to stop the tree from becoming too large. (optional) \n"; print "\t -h (--help) \t Print this usage information \n"; print "\n"; print "This script uses the 'dot' program, which must be in your path.\n"; ! print "'dot' is part of the graphviz package from AT&T research.\n"; exit($exit_code); } *************** *** 30,33 **** --- 32,37 ---- $threshold = 0; $gethelp = 0; + $fliplabels = 0; + $truncatesplits = 0; if ( @ARGV > 0 ) { *************** *** 36,39 **** --- 40,45 ---- 'd|dir=s' => \$dirname, 'h|help' => \$gethelp, + 'l|labels' => \$fliplabels, + 'truncate' => \$truncatesplits, 'threshold=i' => \$threshold) or print_usage(2); *************** *** 90,94 **** $splitType = $1; } ! print "$type, $index, $label, $splitType\n"; } elsif($line =~ /^(\d*)\t\[([^\]]*)\].*p\(1\)= (.*)/) { --- 96,109 ---- $splitType = $1; } ! if ($splitType =~ /InequalitySplitter/ && $truncatesplits) { ! $label =~ /([a-zA-Z0-9\-\s]*)\s*(<|>)\s*(-*[0-9]*(\.)?[0-9]?[0-9]?[0-9]?).*/; ! $var = $1; ! $ineq = $2; ! $val = $3; ! print "$type, $index, $var, $ineq, $val, $splitType\n"; ! $label = "$var $ineq $val" ! } else { ! print "$type, $index, $label, $splitType\n"; ! } } elsif($line =~ /^(\d*)\t\[([^\]]*)\].*p\(1\)= (.*)/) { *************** *** 98,101 **** --- 113,119 ---- $label = $3; $label =~ s/(\d\.\d{3}).*/$1/; + if($fliplabels) { + $label = -$label; + } print "$type, $index, $label\n"; } *************** *** 142,146 **** system("dot -Tpng $filename.$threshold.dot -o $filename.$threshold.png"); system("dot -Tgif $filename.$threshold.dot -o $filename.$threshold.gif"); ! system("dot -Tps2 $filename.$threshold.dot -o $filename.$threshold.ps"); system("ps2pdf $filename.$threshold.ps"); --- 160,166 ---- system("dot -Tpng $filename.$threshold.dot -o $filename.$threshold.png"); system("dot -Tgif $filename.$threshold.dot -o $filename.$threshold.gif"); ! #system("dot -Tps2 $filename.$threshold.dot -o $filename.$threshold.eps"); ! system("dot -Tps $filename.$threshold.dot -o $filename.$threshold.ps"); system("ps2pdf $filename.$threshold.ps"); + system("pstoimg -antialias -aaliastext -density 400 $filename.$threshold.ps"); Index: nfold.py =================================================================== RCS file: /cvsroot/jboost/jboost/scripts/nfold.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nfold.py 27 May 2007 11:19:49 -0000 1.4 --- nfold.py 10 Jul 2007 01:38:38 -0000 1.5 *************** *** 27,31 **** config= os.getenv('JBOOST_CONFIG') command = 'java -Xmx1000M -cp ' + os.getenv('CLASSPATH') \ ! + ' jboost.controller.Controller -p 3 -a -2 -S trial' + str(k) \ + ' -n trial.spec -ATreeType '+ atreeoption +' -numRounds ' + str(rounds) if (config != None): --- 27,31 ---- config= os.getenv('JBOOST_CONFIG') command = 'java -Xmx1000M -cp ' + os.getenv('CLASSPATH') \ ! + ' jboost.controller.Controller -b LogLossBoost -p 3 -a -1 -S trial' + str(k) \ + ' -n trial.spec -ATreeType '+ atreeoption +' -numRounds ' + str(rounds) if (config != None): *************** *** 69,72 **** --- 69,74 ---- print 'k: ' + str(k) + ' start:' + str(start) +' end:' + str(end) # create test/train files + trainfilename = fileprefix + str(k) + trainsuffix; + testfilename = fileprefix + str(k) + testsuffix; testfile= file(fileprefix + str(k)+ testsuffix, 'w') trainfile= file(fileprefix + str(k) + trainsuffix, 'w') *************** *** 76,79 **** --- 78,82 ---- testfile.close() trainfile.close() + os.system('./resample.py --k=128 --label=" 1" --train=' + trainfilename); |