You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(37) |
Jun
(11) |
Jul
(5) |
Aug
|
Sep
(3) |
Oct
(22) |
Nov
|
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(9) |
May
(1) |
Jun
(2) |
Jul
(8) |
Aug
(7) |
Sep
(29) |
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
(8) |
Feb
(18) |
Mar
(5) |
Apr
|
May
|
Jun
(12) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Sunsern C. <sch...@us...> - 2009-02-09 10:45:36
|
Update of /cvsroot/jboost/jboost/src/jboost/booster In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31004/src/jboost/booster Modified Files: RobustBinaryPrediction.java RobustBoostTest.java RobustBoost.java Log Message: fixed bugs and tested with Long&Servedio data Index: RobustBoostTest.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/booster/RobustBoostTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RobustBoostTest.java 5 Feb 2009 05:53:27 -0000 1.1 --- RobustBoostTest.java 9 Feb 2009 10:45:30 -0000 1.2 *************** *** 3,7 **** --- 3,14 ---- + import java.io.BufferedReader; + import java.io.FileNotFoundException; + import java.io.FileReader; + import java.util.StringTokenizer; + import jboost.booster.RobustBoost.NewtonSolver; + import jboost.booster.RobustBoost.RobustBinaryBag; + import jboost.examples.Label; /** *************** *** 15,19 **** RobustBoost m_robustBoost; /** ! * Constructor for BrownBoostTest. * @param arg0 */ --- 22,26 ---- RobustBoost m_robustBoost; /** ! * Constructor for RobustBoostTest. * @param arg0 */ *************** *** 23,27 **** /** ! * Tests the BrownBoost constructor and sets up boosters for * other tests. * @see TestCase#setUp() --- 30,34 ---- /** ! * Tests the RobustBoost constructor and sets up boosters for * other tests. * @see TestCase#setUp() *************** *** 94,111 **** } ! final public void testNewtonSolver() { ! double sigma_f = 0.1d; ! double theta = 0.2d; ! double rho = 1.6; - double[] margins = new double[] {-10,-10,-10,-10,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,10,10,10,10}; - double[] steps = new double[] {-1,-1,1,1,-1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,1,-1,1,1}; ! NewtonSolver ns = m_robustBoost.new NewtonSolver(margins,steps,0.1,0.6,10,rho,theta,sigma_f); ! //System.out.print(ns.getLog()); ! assertEquals(ns.getDs(),1.427, 0.001); ! assertEquals(ns.getDt(),0.263, 0.001); } - } --- 101,237 ---- } ! ! ! final public void testLongData() { ! int[] best = new int[] {1,2,10,12,1,7,4,17,8,1,9,2,6,15,3,20,19,13,16,14}; ! double[] times = new double[] { 0.125, 0.172, 0.189, 0.203, 0.212, 0.226, 0.234, 0.240, 0.246, 0.252, ! 0.256, 0.260, 0.264, 0.268, 0.271, 0.273, 0.276, 0.278, 0.2791, 0.280}; ! ! int numFeatures = 21; ! int numExamples = 800; ! ! try { ! ! int[][] data = new int[numExamples][numFeatures]; ! int[] labels = new int[numExamples]; ! ! RobustBoost rBoost = new RobustBoost(false,0.14,new double[] {0.2,0.2}, new double[] {0.1,0.1}, new double[] {1,1}); ! ! assertEquals(rBoost.m_epsilon,0.14,0.0001); ! assertEquals(rBoost.m_theta[0],0.2,0.0001); ! assertEquals(rBoost.m_sigma_f[0],0.1,0.0001); ! assertEquals(rBoost.m_rho[0],0.7233,0.0001); ! ! BufferedReader br = new BufferedReader(new FileReader("demo/Long.train")); ! // read input ! String line = br.readLine(); ! int j=0; ! while (line != null) { ! ! StringTokenizer st = new StringTokenizer(line,",;"); ! ! labels[j] = Math.round(Float.parseFloat(st.nextToken())); ! ! int i =0; ! while (st.hasMoreTokens()) { ! String s = st.nextToken(); ! data[j][i] = Math.round(Float.parseFloat(s)); ! assertEquals(data[j][i] == -1 || data[j][i] == 1, true); ! i++; ! } ! j++; ! line = br.readLine(); ! } ! br.close(); ! ! for (int i=0;i<numExamples;i++) { ! assertEquals((labels[i] == -1) || (labels[i] == 1), true); ! ! if (labels[i] == -1) labels[i] = 0; ! ! rBoost.addExample(i, new Label(labels[i])); ! } ! ! rBoost.finalizeData(); ! int iter=0; ! while (iter < 20 && !rBoost.isFinished()) { ! ! int[][] best_lists = new int[][] {null, null}; ! int best_feature = -1; ! double best_gain = -1; ! ! // find the best weak rule ! for (int i=0;i<numFeatures;i++) { ! ! double gain, gain0 = 0, gain1 = 0; ! int count0 = 0, count1 = 0, p=0; ! for (int k=0;k<numExamples;k++) { ! ! if (data[k][i] == -1) count0++; ! else count1++; ! ! if (labels[k] == 0 && data[k][i] == -1) { ! gain0 += rBoost.m_weights[k]; ! } ! else if (labels[k] == 0 && data[k][i] == 1) { ! gain0 -= rBoost.m_weights[k]; ! } ! ! if (labels[k] == 1 && data[k][i] == 1) { ! gain1 += rBoost.m_weights[k]; ! } ! else if (labels[k] == 1 && data[k][i] == -1) { ! gain1 -= rBoost.m_weights[k]; ! } ! ! } ! ! gain = gain0 + gain1; ! ! int[] list0 = new int[count0]; ! int[] list1 = new int[count1]; ! int list0_idx = 0, list1_idx = 0; ! for (int k=0;k<numExamples;k++) { ! if (data[k][i] == -1) list0[list0_idx++] = k; ! else if (data[k][i] == 1) list1[list1_idx++] = k; ! } ! ! gain = Math.abs(gain); ! ! ! if (gain > best_gain) { ! best_feature = i; ! best_gain = gain; ! best_lists[0] = list0; ! best_lists[1] = list1; ! } ! } ! ! ! Bag[] best_bags = new Bag[2]; ! best_bags[0] = rBoost.newBag(best_lists[0]); ! best_bags[1] = rBoost.newBag(best_lists[1]); ! ! int[][] exampleIndex = new int[2][]; ! exampleIndex[0] = best_lists[0]; ! exampleIndex[1] = best_lists[1]; ! ! Prediction[] predictions = rBoost.getPredictions(best_bags, exampleIndex); ! rBoost.update(predictions, exampleIndex); ! ! assertEquals(best_feature+1,best[iter]); ! assertEquals(rBoost.m_t,times[iter],0.001); ! ! iter++; ! } ! ! } catch (Exception e) { ! // TODO Auto-generated catch block ! e.printStackTrace(); ! } ! } } Index: RobustBinaryPrediction.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/booster/RobustBinaryPrediction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RobustBinaryPrediction.java 5 Feb 2009 05:53:27 -0000 1.1 --- RobustBinaryPrediction.java 9 Feb 2009 10:45:30 -0000 1.2 *************** *** 12,15 **** --- 12,17 ---- public class RobustBinaryPrediction extends Prediction{ + /** starting point for Newton's method */ + protected double init_ds; /** time step used to scale previous predictions */ protected double dt; Index: RobustBoost.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/booster/RobustBoost.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RobustBoost.java 5 Feb 2009 06:32:38 -0000 1.2 --- RobustBoost.java 9 Feb 2009 10:45:30 -0000 1.3 *************** *** 9,14 **** import jboost.examples.Label; - - /** * Java implemantation of RobustBoost. --- 9,12 ---- *************** *** 31,68 **** protected double[] m_sampleWeights; [...1463 lines suppressed...] if (!succeeded) { ! log.append("BinarySearch failed!\n"); ds = Double.NaN; dt = Double.NaN; } else { ! log.append("BinarySearch completed successfully!\n"); } } *************** *** 1137,1140 **** } ! ! } /** end of class AdaBoost */ --- 1403,1406 ---- } ! ! } |
From: Sunsern C. <sch...@us...> - 2009-02-09 10:40:27
|
Update of /cvsroot/jboost/jboost/src/jboost/controller In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30007/src/jboost/controller Modified Files: Controller.java Log Message: changed printout message for RobustBoost Index: Controller.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/controller/Controller.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Controller.java 5 Feb 2009 05:59:04 -0000 1.14 --- Controller.java 9 Feb 2009 10:40:19 -0000 1.15 *************** *** 446,453 **** if(m_booster instanceof RobustBoost){ ! NumberFormat f= new DecimalFormat("0.000000"); ! System.out.println("[Iter = " + iter + ! ",Time = " + f.format(((RobustBoost)m_booster).getCurrentTime()) + ! ",TotalWeight = " + f.format(((RobustBoost)m_booster).getTotalWeight()) + "]"); } else --- 446,456 ---- if(m_booster instanceof RobustBoost){ ! NumberFormat f= new DecimalFormat("0.00000"); ! System.out.println("" + ! "[Iter= " + iter + ! ", Time= " + f.format(((RobustBoost)m_booster).getCurrentTime()) + ! ", Active Examples= " + ((RobustBoost)m_booster).getNumActiveExamples() + ! ", ds= " + f.format(((RobustBoost)m_booster).getLastDs()) + ! ", dt= " + f.format(((RobustBoost)m_booster).getLastDt()) + "]"); } else |
From: Sunsern C. <sch...@us...> - 2009-02-05 06:32:42
|
Update of /cvsroot/jboost/jboost/src/jboost/booster In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12312/src/jboost/booster Modified Files: RobustBoost.java Log Message: Rename input options Index: RobustBoost.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/booster/RobustBoost.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RobustBoost.java 5 Feb 2009 05:53:27 -0000 1.1 --- RobustBoost.java 5 Feb 2009 06:32:38 -0000 1.2 *************** *** 55,59 **** * default constructor * ! * epsilon = 0.1 * theta = 0.0 * sigma_f = 0.1 --- 55,59 ---- * default constructor * ! * epsilon = 0.001 * theta = 0.0 * sigma_f = 0.1 *************** *** 83,89 **** public void init(Configuration config) { ! m_epsilon= config.getDouble("epsilon", 0.1); ! m_theta= config.getDouble("theta", 1.0); ! m_sigma_f= config.getDouble("sigma_f", 0.1); m_rho = calculateRho(); --- 83,89 ---- public void init(Configuration config) { ! m_epsilon= config.getDouble("rb_epsilon", 0.1); ! m_theta= config.getDouble("rb_theta", 0.0); ! m_sigma_f= config.getDouble("rb_sigma_f", 0.1); m_rho = calculateRho(); |
From: Sunsern C. <sch...@us...> - 2009-02-05 06:32:15
|
Update of /cvsroot/jboost/jboost/src/jboost/controller In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12285/src/jboost/controller Modified Files: Configuration.java Log Message: Rename RobustBoost options Index: Configuration.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/controller/Configuration.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Configuration.java 5 Feb 2009 06:04:23 -0000 1.12 --- Configuration.java 5 Feb 2009 06:32:10 -0000 1.13 *************** *** 116,122 **** + "******** RobustBoost Options:\n" + "\n" ! + " -epsilon NUM See documentation.\n" ! + " -theta NUM See documentation.\n" ! + " -sigma_f NUM See documentation.\n" + "\n" + "******** Output Options:\n" --- 116,122 ---- + "******** RobustBoost Options:\n" + "\n" ! + " -rb_epsilon NUM See documentation.\n" ! + " -rb_theta NUM See documentation.\n" ! + " -rb_sigma_f NUM See documentation.\n" + "\n" + "******** Output Options:\n" |
From: Sunsern C. <sch...@us...> - 2009-02-05 06:04:29
|
Update of /cvsroot/jboost/jboost/src/jboost/controller In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10320/src/jboost/controller Modified Files: Configuration.java Log Message: Update version number to 1.5 Index: Configuration.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/controller/Configuration.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Configuration.java 5 Feb 2009 05:58:18 -0000 1.11 --- Configuration.java 5 Feb 2009 06:04:23 -0000 1.12 *************** *** 55,59 **** private Vector m_validCommands; private String m_unSpecified; ! public final static String VERSION="1.4"; private final static String m_usage = "" + "jboost Version " + VERSION + "\n" --- 55,59 ---- private Vector m_validCommands; private String m_unSpecified; ! public final static String VERSION="1.5"; private final static String m_usage = "" + "jboost Version " + VERSION + "\n" |
From: Sunsern C. <sch...@us...> - 2009-02-05 05:59:09
|
Update of /cvsroot/jboost/jboost/src/jboost/controller In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9644/src/jboost/controller Modified Files: Controller.java Log Message: Add support for RobustBoost Index: Controller.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/controller/Controller.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Controller.java 3 Jan 2009 05:13:32 -0000 1.13 --- Controller.java 5 Feb 2009 05:59:04 -0000 1.14 *************** *** 7,10 **** --- 7,12 ---- import java.io.ObjectOutputStream; import java.io.PrintWriter; + import java.text.DecimalFormat; + import java.text.NumberFormat; import java.util.Iterator; import java.util.Vector; *************** *** 21,24 **** --- 23,27 ---- import jboost.booster.Booster; import jboost.booster.Prediction; + import jboost.booster.RobustBoost; import jboost.examples.BadLabelException; import jboost.examples.Example; *************** *** 437,444 **** + iter); } if(m_booster instanceof BrownBoost){ ! iterNo++; } ! System.out.println("Finished learning iteration " + iter); if (Monitor.logLevel > 1) { m_monitor.logIteration( --- 440,457 ---- + iter); } + if(m_booster instanceof BrownBoost){ ! iterNo++; } ! ! if(m_booster instanceof RobustBoost){ ! NumberFormat f= new DecimalFormat("0.000000"); ! System.out.println("[Iter = " + iter + ! ",Time = " + f.format(((RobustBoost)m_booster).getCurrentTime()) + ! ",TotalWeight = " + f.format(((RobustBoost)m_booster).getTotalWeight()) + "]"); ! } ! else ! System.out.println("Finished learning iteration " + iter); ! if (Monitor.logLevel > 1) { m_monitor.logIteration( |
From: Sunsern C. <sch...@us...> - 2009-02-05 05:58:23
|
Update of /cvsroot/jboost/jboost/src/jboost/controller In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9586/src/jboost/controller Modified Files: Configuration.java Log Message: Add RobustBoost to m_usage Index: Configuration.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/controller/Configuration.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Configuration.java 3 Jan 2009 05:13:32 -0000 1.10 --- Configuration.java 5 Feb 2009 05:58:18 -0000 1.11 *************** *** 59,141 **** + "jboost Version " + VERSION + "\n" + "\n" ! + "** Config Options:\n" + "\n" ! + "\t-p N Specify number of threads (default: 1)\n" ! + "\t-CONFIG The name of the configuration file (default \"jboost.config\")\n" ! + "\t All options can be specified in this file instead of\n" ! + "\t on the command line.\n" ! + "\t-V Print version and exit\n" + "\n" ! + "** Data File Options:\n" + "\n" ! + "\t-S stem Base (stem) name for the files (default: \"data\")\n" ! + "\t-n file.spec Specfile name (default: stem+\".spec\")\n" ! + "\t-t file.train Training file name (default: stem+\".train\")\n" ! + "\t-T file.test Test file name (default: stem+\".test\")\n" ! + "\t-serialTreeInput file.tree Java object output of adtree (can be loaded\n" ! + "\t at a later date)\n" + "\n" ! + "** Boosting Options:\n" + "\n" ! + "\t-b type The type of booster to use (default: AdaBoost).\n" ! + "\t AdaBoost Loss function: exp(-margin)\n" ! + "\t LogLossBoost Loss: log(1 + exp(-margin))\n" ! + "\t BrownBoost Loss: 1/2 - 1/2 * erf((-margin + time_remaining)\n" ! + "\t / sqrt(total_time))\n" ! + "\t YabaBoost Loss: see documentation (it's a tad complicated...).\n" ! + "\t-numRounds N The number of rounds of boosting that are to be executed.\n" ! + "\t This option should be used with AdaBoost and LogitBoost\n" ! + "\t-ATreeType type The type of ATree to create. There are several options:\n" ! + "\t ADD_ALL Create a full ADTree (default)\n" ! + "\t ADD_ROOT Add splits only at the root producing a glat tree.\n" ! + "\t This is equivalent to boosting decision stumps\n" ! + "\t ADD_SINGLES Create a decision tree\n" ! + "\t ADD_ROOT_OR_SINGLES Create a linear combination of decision trees.\n" ! + "\t This is equivalent to simultaneously growing \n" ! + "\t boosted decision trees.\n" ! + "\t-BoosTexter Only make a zero prediction at the root node.\n" ! + "\t-booster_smooth sf Smoothing factor for prediction computation (default: 0.5)\n" ! + "\t Described Schapire & Singer 1999 (smoothing the predictions), \n" ! + "\t $epsilon = sf / total_num_examples$ \n" ! + "\t-booster_paranoid Use safe version of booster (default: false)\n" + "\n" + "******** BrownBoost Options:\n" + "\n" ! + "\t\t-r c The \"runtime\" of the boosting game.\n" ! + "\t\t This option should be used with BrownBoost and YabaBoost\n" ! + "\t\t-potential Prints the potential associated with the runtime\n" + "\n" + "******** YabaBoost Options (includes BrownBoost options):\n" + "\n" ! + "\t\t-c1 NUM See documentation.\n" ! + "\t\t-c2 NUM See documentation.\n" ! + "\t\t-theta NUM See documentation.\n" + "\n" ! + "** Output Options:\n" + "\n" ! + "\t-O file.tree Output tree file name (default: stem+\".output.tree\")\n" ! + "\t-serialTreeOutput file.tree Java object output of adtree (can be loaded\n" ! + "\t at a later date)\n" ! + "\t-P filename Output Python code file name (default: stem+\".output.py\"\n" ! + "\t-j filename Output java code file name (default: stem+\".output.java\"\n" ! + "\t-c filename Output C code file name (default: stem+\".output.c\")\n" ! + "\t-m filename Output matlab code file name (default: stem+\".output.java\"\n" ! + "\t-cOutputProc name Name of procedure for output C code (default: 'predict')\n" ! + "\t-javaStandAlone Output java code that can stand alone, but\n" ! + "\t cannot read jboost-format data\n" ! + "\t-javaOutputClass name Name of class for output java code (default: 'Predict')\n" ! + "\t-javaOutputMethod name Name of method for output java code (default: 'predict')\n" + "\n" ! + "** Logging Options:\n" + "\n" ! + "\t-info filename High-level log file name (default: stem+\".info\")\n" ! + "\t-log filename Debugging log (default stem+\".log\")\n" ! + "\t-loglevel N Amount of information to be output to log \n" ! + "\t The larger N is, the more information will be output.\n" ! + "\t This is meant to be used as a debugging tool.\n" ! + "\t-a iter Generate margin (score) logs \n" ! + "\t iter>0 log only on iteration iter,\n" ! + "\t iter=-1 log on iters 1,2..9,10,20,...,90,100,200 ...)\n" ! + "\t iter=-2 log on all iterations\n"; --- 59,151 ---- + "jboost Version " + VERSION + "\n" + "\n" ! + "******** Config Options:\n" + "\n" ! + " -p N Specify number of threads (default: 1)\n" ! + " -CONFIG The name of the configuration file (default \"jboost.config\")\n" ! + " All options can be specified in this file instead of\n" ! + " on the command line.\n" ! + " -V Print version and exit\n" + "\n" ! + "******** Data File Options:\n" + "\n" ! + " -S stem Base (stem) name for the files (default: \"data\")\n" ! + " -n file.spec Specfile name (default: stem+\".spec\")\n" ! + " -t file.train Training file name (default: stem+\".train\")\n" ! + " -T file.test Test file name (default: stem+\".test\")\n" ! + " -serialTreeInput file.tree Java object output of adtree (can be loaded\n" ! + " at a later date)\n" + "\n" ! + "******** Boosting Options:\n" + "\n" ! + " -b type The type of booster to use (default: AdaBoost).\n" ! + " AdaBoost Loss function: exp(-margin)\n" ! + " LogLossBoost Loss: log(1 + exp(-margin))\n" ! + " BrownBoost Loss: 1/2 - 1/2 * erf((-margin + time_remaining)\n" ! + " / sqrt(total_time))\n" ! + " YabaBoost Loss: see documentation (it's a tad complicated...).\n" ! + " RobustBoost Loss: min(1,1-erf((margin - mu(time))/sigma(time)))\n" ! + " -numRounds N The number of rounds of boosting that are to be executed.\n" ! + " This option should be used with AdaBoost and LogitBoost\n" ! + " -ATreeType type The type of ATree to create. There are several options:\n" ! + " ADD_ALL Create a full ADTree (default)\n" ! + " ADD_ROOT Add splits only at the root producing a glat tree.\n" ! + " This is equivalent to boosting decision stumps\n" ! + " ADD_SINGLES Create a decision tree\n" ! + " ADD_ROOT_OR_SINGLES Create a linear combination of decision trees.\n" ! + " This is equivalent to simultaneously growing \n" ! + " boosted decision trees.\n" ! + " -BoosTexter Only make a zero prediction at the root node.\n" ! + " -booster_smooth sf Smoothing factor for prediction computation\n" ! + " (default: 0.5) Described Schapire & Singer 1999\n" ! + " (smoothing the predictions), \n" ! + " $epsilon = sf / total_num_examples$ \n" ! + " -booster_paranoid Use safe version of booster (default: false)\n" + "\n" + "******** BrownBoost Options:\n" + "\n" ! + " -r c The \"runtime\" of the boosting game.\n" ! + " This option should be used with BrownBoost and YabaBoost\n" ! + " -potential Prints the potential associated with the runtime\n" + "\n" + "******** YabaBoost Options (includes BrownBoost options):\n" + "\n" ! + " -c1 NUM See documentation.\n" ! + " -c2 NUM See documentation.\n" ! + " -theta NUM See documentation.\n" + "\n" ! + "******** RobustBoost Options:\n" + "\n" ! + " -epsilon NUM See documentation.\n" ! + " -theta NUM See documentation.\n" ! + " -sigma_f NUM See documentation.\n" + "\n" ! + "******** Output Options:\n" + "\n" ! + " -O file.tree Output tree file name (default: stem+\".output.tree\")\n" ! + " -serialTreeOutput file.tree Java object output of adtree (can be loaded\n" ! + " at a later date)\n" ! + " -P filename Output Python code file name (default: stem+\".output.py\"\n" ! + " -j filename Output java code file name (default: stem+\".output.java\"\n" ! + " -c filename Output C code file name (default: stem+\".output.c\")\n" ! + " -m filename Output matlab code file name (default: stem+\".output.java\"\n" ! + " -cOutputProc name Name of procedure for output C code (default: 'predict')\n" ! + " -javaStandAlone Output java code that can stand alone, but\n" ! + " cannot read jboost-format data\n" ! + " -javaOutputClass name Name of class for output java code\n" ! + " (default: 'Predict')\n" ! + " -javaOutputMethod name Name of method for output java code\n" ! + " (default: 'predict')\n" ! + "\n" ! + "******** Logging Options:\n" ! + "\n" ! + " -info filename High-level log file name (default: stem+\".info\")\n" ! + " -log filename Debugging log (default stem+\".log\")\n" ! + " -loglevel N Amount of information to be output to log \n" ! + " The larger N is, the more information will be output.\n" ! + " This is meant to be used as a debugging tool.\n" ! + " -a iter Generate margin (score) logs \n" ! + " iter>0 log only on iteration iter,\n" ! + " iter=-1 log on iters 1,2..9,10,20,...,90,100,200 ...)\n" ! + " iter=-2 log on all iterations\n"; |
From: Sunsern C. <sch...@us...> - 2009-02-05 05:57:06
|
Update of /cvsroot/jboost/jboost/src/jboost/atree In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9501/src/jboost/atree Modified Files: InstrumentedAlternatingTree.java Log Message: Added support for RobustBoost Index: InstrumentedAlternatingTree.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/atree/InstrumentedAlternatingTree.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** InstrumentedAlternatingTree.java 24 Jan 2008 22:48:53 -0000 1.6 --- InstrumentedAlternatingTree.java 5 Feb 2009 05:56:57 -0000 1.7 *************** *** 16,19 **** --- 16,20 ---- import jboost.booster.Prediction; import jboost.booster.NormalizedPrediction; + import jboost.booster.RobustBinaryPrediction; import jboost.controller.Configuration; import jboost.controller.ConfigurationException; *************** *** 35,450 **** public class InstrumentedAlternatingTree extends ComplexLearner { [...1448 lines suppressed...] ! } ! /** Constructor to specify that only the root prediction should be updated. */ ! public AtreeCandidateSplit(double loss) { ! updateRoot= true; ! this.loss= loss; ! pNode= 0; ! builder= null; ! splitter= null; ! partition= null; ! } } /** Contains a SplitterBuilder and the number of the PredictorNode to which it belongs. */ class PredictorNodeSB { ! public int pNode; ! public SplitterBuilder[] SB; ! public PredictorNodeSB(int p, SplitterBuilder[] sb) { ! SB= sb; ! pNode= p; ! } } |
From: Sunsern C. <sch...@us...> - 2009-02-05 05:55:18
|
Update of /cvsroot/jboost/jboost/src/jboost/booster In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9247/src/jboost/booster Modified Files: AdaBoost.java Log Message: Properly use m_sampleWeight for updating totalWeight and Bags Index: AdaBoost.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/booster/AdaBoost.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AdaBoost.java 10 Apr 2008 07:54:16 -0000 1.7 --- AdaBoost.java 5 Feb 2009 05:55:06 -0000 1.8 *************** *** 187,192 **** m_sampleWeights[index]= a.getWeight(); } - m_totalWeight= defaultWeight*m_numExamples; m_tmpList.clear(); // free the memory } --- 187,193 ---- m_sampleWeights[index]= a.getWeight(); + m_totalWeight += defaultWeight*a.getWeight(); + } m_tmpList.clear(); // free the memory } *************** *** 478,484 **** int example= indexes[j]; m_margins[example] += value[m_labels[example]]; ! m_totalWeight -= m_weights[example]; m_weights[example]= calculateWeight(m_margins[example]); ! m_totalWeight += m_weights[example]; } } --- 479,485 ---- int example= indexes[j]; m_margins[example] += value[m_labels[example]]; ! m_totalWeight -= m_weights[example] * m_sampleWeights[example]; m_weights[example]= calculateWeight(m_margins[example]); ! m_totalWeight += m_weights[example] * m_sampleWeights[example]; } } *************** *** 604,608 **** */ public void subtractExample(int i) { ! if ((m_w[m_labels[i]] -= m_weights[i]) < 0.0) m_w[m_labels[i]]= 0.0; } --- 605,609 ---- */ public void subtractExample(int i) { ! if ((m_w[m_labels[i]] -= m_weights[i]*m_sampleWeights[i]) < 0.0) m_w[m_labels[i]]= 0.0; } |
From: Sunsern C. <sch...@us...> - 2009-02-05 05:54:05
|
Update of /cvsroot/jboost/jboost/src/jboost/booster In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8885/src/jboost/booster Added Files: RobustBinaryPrediction.java RobustBoostTest.java RobustBoost.java Log Message: Added RobustBoost classes to JBoost. --- NEW FILE: RobustBoostTest.java --- package jboost.booster; import jboost.booster.RobustBoost.NewtonSolver; /** * @author Sunsern Cheamanunkul * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class RobustBoostTest extends AbstractBoosterTest { RobustBoost m_robustBoost; /** * Constructor for BrownBoostTest. * @param arg0 */ public RobustBoostTest(String arg0) { super(arg0); } /** * Tests the BrownBoost constructor and sets up boosters for * other tests. * @see TestCase#setUp() */ protected void setUp() throws Exception { m_odd= new RobustBoost(); m_even= new RobustBoost(); m_allTrue= new RobustBoost(); m_allFalse= new RobustBoost(); m_robustBoost= new RobustBoost(); m_solitaires= new RobustBoost[COUNT]; for (int i=0; i < COUNT; i++) { m_solitaires[i]= new RobustBoost(); } super.setUp(); } final public void testAddExample() { //TODO Implement addExample(). } final public void testFinalizeData() { //TODO Implement finalizeData(). } final public void testClear() { //TODO Implement clear(). } /* * Test for Bag newBag(int[]) */ final public void testNewBagintArray() { //TODO Implement newBag(). } /* * Test for Bag newBag() */ final public void testNewBag() { //TODO Implement newBag(). } /* * Test for Bag newBag(Bag) */ final public void testNewBagBag() { //TODO Implement newBag(). } public final void testUpdate() { } final public void testGetPredictions() { //TODO Implement getPredictions(). } final public void testGetTheoryBound() { //TODO Implement getTheoryBound(). } final public void testGetMargins() { //TODO Implement getMargins(). } final public void testGetPrediction() { //TODO Implement getPrediction(). } final public void testNewtonSolver() { double sigma_f = 0.1d; double theta = 0.2d; double rho = 1.6; double[] margins = new double[] {-10,-10,-10,-10,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,10,10,10,10}; double[] steps = new double[] {-1,-1,1,1,-1,-1,1,1,1,-1,1,-1,1,-1,1,1,1,1,-1,1,1}; NewtonSolver ns = m_robustBoost.new NewtonSolver(margins,steps,0.1,0.6,10,rho,theta,sigma_f); //System.out.print(ns.getLog()); assertEquals(ns.getDs(),1.427, 0.001); assertEquals(ns.getDt(),0.263, 0.001); } } --- NEW FILE: RobustBinaryPrediction.java --- package jboost.booster; import jboost.examples.Label; /** * This is used by RobustBoost. * * This is a prediction for a binary label, which consists of a single * real valued number whose sign is the prediction and whose magnitude * is the prediction confidence **/ public class RobustBinaryPrediction extends Prediction{ /** time step used to scale previous predictions */ protected double dt; protected double prediction; public RobustBinaryPrediction(double p) {prediction=p; dt=0; } public RobustBinaryPrediction() {prediction=0.0; dt=0; } public RobustBinaryPrediction(double p, double dt) {prediction=p; this.dt=dt;} public double getDt() { return dt; } public void setDt(double dt) { this.dt = dt; } public Object clone(){ Object a = new RobustBinaryPrediction(prediction); return a; } public Prediction add(Prediction p) { if (p != null) { prediction += ((RobustBinaryPrediction) p).prediction; } return this; } public Prediction scale(double w) { prediction *= w; return this; } public Prediction add(double w, Prediction p) { prediction += w * ((RobustBinaryPrediction) p).prediction; return this; } public double[] getClassScores() { double[] a = {-prediction,prediction}; return a; } /** * computes margin as y * prediction, where y = -1 if label = 0, * y = +1 if label = 1. */ public double[] getMargins(Label label) { int l = label.getSingleValue(); if(l > 1 || l < 0) { throw new IllegalArgumentException( "Adaboost.getMargin should get a label which " + "is either 0 or 1. Instead it got " + l); } return new double[] { (l == 1 ? prediction : -prediction) }; } public boolean equals(Prediction other) { RobustBinaryPrediction bp= (RobustBinaryPrediction) other; return (prediction == bp.prediction); } /** * computes margin as absolute value of prediction. */ /* public double getMargin() { return (prediction < 0.0 ? -prediction : prediction); } */ public Label getBestClass() { return new Label(prediction > 0 ? 1 : 0); } public String toString() { return "BinaryPrediction. p(1)= "+prediction; } public String shortText() { return Double.toString(prediction); } public String cPreamble() { return "typedef double Prediction_t;\n" + "#define reset_pred() {p = 0.0;}\n" + "#define add_pred(X) {p += (X);}\n" + "#define finalize_pred()" + " ((r) ? (r[1] = p , r[0] = -p) : -p)\n"; } public String javaPreamble() { return "" + " static private double p;\n" + " static private void reset_pred() { p = 0.0; }\n" + " static private void add_pred(double x) { p += x; }\n" + " static private double[] finalize_pred() {\n" + " return new double[] {-p, p};\n" + " }\n"; } public double[] toCodeArray() { return new double[] {prediction}; } } --- NEW FILE: RobustBoost.java --- package jboost.booster; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; import jboost.controller.Configuration; import jboost.examples.Label; /** * Java implemantation of RobustBoost. * * @author Sunsern Cheamanunkul */ public class RobustBoost extends AbstractBooster { [...1101 lines suppressed...] public boolean isSucceeded() { return succeeded; } public double getDs() { return ds; } public double getDt() { return dt; } public String getLog() { return log.toString(); } } } /** end of class AdaBoost */ |
From: william b. <wil...@us...> - 2009-01-25 08:52:44
|
Update of /cvsroot/jboost/jboost/scripts In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25502/scripts Modified Files: VisualizeScores.README VisualizeScores.DEMO.README Log Message: updated to reflect new output directory structure from nfold.py Index: VisualizeScores.DEMO.README =================================================================== RCS file: /cvsroot/jboost/jboost/scripts/VisualizeScores.DEMO.README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VisualizeScores.DEMO.README 25 Jan 2009 08:19:49 -0000 1.1 --- VisualizeScores.DEMO.README 25 Jan 2009 08:52:38 -0000 1.2 *************** *** 5,11 **** 0. you have java, jython, and python installed. ! 1. you have downloaded the jboost dist from sourceforge.net and built jboost from source. ! ! You CANNOT use the prebuilt jboost.jar (version 1.4 or earlier) as we are using a yet-unreleased version of jboost. 2. You setup your CLASSPATH and JBOOST_DIR environment variables per the install instructions on http://jboost.sourceforge.net/install.html --- 5,9 ---- 0. you have java, jython, and python installed. ! 1. you have downloaded the jboost dist from sourceforge.net and built jboost from source or you downloaded the pre-release. (ie. you have jboost 1.4.1 or greater) 2. You setup your CLASSPATH and JBOOST_DIR environment variables per the install instructions on http://jboost.sourceforge.net/install.html *************** *** 58,62 **** Booster type: jboost.booster.LogLossBoost Read 100 training examples ! Read 200 training examples Read 300 training examples Read 400 training examples --- 56,60 ---- Booster type: jboost.booster.LogLossBoost Read 100 training examples ! Read 200 training examples Read 300 training examples Read 400 training examples *************** *** 66,80 **** [snip] you get the idea. ! 5. the results are placed in the directory ./cvdata-mm-dd-hh-mm-ss/<TREE-TYPE> 6. Now run the visualizer in the scripts. Assuming jython is not on your path, be explicit: ! > ~/jython2.2.1/jython ../scripts/VisualizeScores.py cvdata-mm-dd-hh-mm-ss/ADD_ALL/trial (note, this example output shows the cvdata-mm-dd-hh-mm-ss for my test run) ! ['cvdata-01-16-17-44-23/ADD_ALL/trial0.test.boosting.info', 'cvdata-01-16-17-44-23/ADD_ALL/trial1.test.boosting.info'] ! cvdata-01-16-17-44-23/ADD_ALL/trial0.test.boosting.info ! cvdata-01-16-17-44-23/ADD_ALL/trial1.test.boosting.info index=0, a.length=4600 index=1, a.length=4600 --- 64,78 ---- [snip] you get the idea. ! 5. the results are placed in the directory ./spambase_idx.data.folds_2/cvdata-mm-dd-hh-mm-ss/<TREE-TYPE> 6. Now run the visualizer in the scripts. Assuming jython is not on your path, be explicit: ! > ~/jython2.2.1/jython ../scripts/VisualizeScores.py spambase_idx.data.folds_2/cvdata-mm-dd-hh-mm-ss/ADD_ALL/trial (note, this example output shows the cvdata-mm-dd-hh-mm-ss for my test run) ! ['spambase_idx.data.folds_2/cvdata-01-16-17-44-23/ADD_ALL/trial0.test.boosting.info', 'spambase_idx.data.folds_2/cvdata-01-16-17-44-23/ADD_ALL/trial1.test.boosting.info'] ! spambase_idx.data.folds_2/cvdata-01-16-17-44-23/ADD_ALL/trial0.test.boosting.info ! spambase_idx.data.folds_2/cvdata-01-16-17-44-23/ADD_ALL/trial1.test.boosting.info index=0, a.length=4600 index=1, a.length=4600 Index: VisualizeScores.README =================================================================== RCS file: /cvsroot/jboost/jboost/scripts/VisualizeScores.README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VisualizeScores.README 17 Jan 2009 02:00:31 -0000 1.1 --- VisualizeScores.README 25 Jan 2009 08:52:38 -0000 1.2 *************** *** 6,10 **** ============ * Jython ! * build of jboost from current cvs src tree (NOT THE PREBUILT JBOOST.JAR VERSION 1.4) * test | train.boosting.info files which are indexed (see AddRandomIndex.py) * binary class labels (i.e. no multilabel support at this time) --- 6,10 ---- ============ * Jython ! * build of jboost 1.4.1 (NOT JBOOST VERSION 1.4 found on sourceforge) * test | train.boosting.info files which are indexed (see AddRandomIndex.py) * binary class labels (i.e. no multilabel support at this time) *************** *** 25,29 **** Example ======= ! (this example is run from within Jython dist): [user@host jython2.2.1]$ export JBOOST_DIR=/Users/jsmith/workspace/jboost/ (export for a bash shell. ignore if already done) --- 25,29 ---- Example ======= ! (this example is run from within Jython dist and assumes ): [user@host jython2.2.1]$ export JBOOST_DIR=/Users/jsmith/workspace/jboost/ (export for a bash shell. ignore if already done) *************** *** 33,37 **** (NOTE: ASSUMES you have already added jboost.jar and concurrent.jar to your classpath) ! [user@host jython2.2.1]$ ./jython $JBOOST_DIR/scripts/VisualizeScores.py /Users/jsmith/boostingdata/cvdata/ADD_ALL/trial After loading, parsing, and analyzing the boosting.info files, the GUI will launch. Boosting iteration shown in upper right. A histogram showing example count by boosting score for each label is predominate and in the center of the window. Sliders below the histogram allow you select lower and upper score ranges. The region within this range on the ROC curve is shown in the upper left of the window. Pressing the button in the lower left (save selected examples) will write to a file the example index and boosting score for each example within the selected range. This file is saved to the directory indicated in step 1 above. --- 33,37 ---- (NOTE: ASSUMES you have already added jboost.jar and concurrent.jar to your classpath) ! [user@host jython2.2.1]$ ./jython $JBOOST_DIR/scripts/VisualizeScores.py /Users/jsmith/boostingdata/<path to specific cvdata>/ADD_ALL/trial After loading, parsing, and analyzing the boosting.info files, the GUI will launch. Boosting iteration shown in upper right. A histogram showing example count by boosting score for each label is predominate and in the center of the window. Sliders below the histogram allow you select lower and upper score ranges. The region within this range on the ROC curve is shown in the upper left of the window. Pressing the button in the lower left (save selected examples) will write to a file the example index and boosting score for each example within the selected range. This file is saved to the directory indicated in step 1 above. |
From: william b. <wil...@us...> - 2009-01-25 08:20:00
|
Update of /cvsroot/jboost/jboost/scripts In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23938/scripts Added Files: VisualizeScores.DEMO.README Removed Files: VisualizeScores.DEMO Log Message: File rename --- NEW FILE: VisualizeScores.DEMO.README --- Score visualization demo using spambase demo data and nfold validation: Assumptions ========== 0. you have java, jython, and python installed. 1. you have downloaded the jboost dist from sourceforge.net and built jboost from source. You CANNOT use the prebuilt jboost.jar (version 1.4 or earlier) as we are using a yet-unreleased version of jboost. 2. You setup your CLASSPATH and JBOOST_DIR environment variables per the install instructions on http://jboost.sourceforge.net/install.html 3. You are running on linux or mac. Instructions are for BASH shell. Mod as appropriate for your environment. The Demo steps: we are going to do nFold validation on the spambase demo data found in $JOOST_DIR/demo. ============== 1. add some libs to your (existing) java CLASSPATH: > export CLASSPATH=$CLASSPATH:$JBOOST_DIR/lib/jcommon-1.0.8.jar:$JBOOST_DIR/lib/jfreechart-1.0.10.jar:$JBOOST_DIR/lib/swing-layout-1.0.jar 2. cd to the demo directory > cd $JBOOST_DIR/demo 3. add an index number to each row of example data and shuffle the examples. We have a python script to do this for you. > ls spam* spambase.data spambase.test spambase.spec spambase.train > ../scripts/AddRandomIndex.py spambase wrote spambase_idx.data. wrote spambase_idx.spec. > ls spam* spambase.data spambase.test spambase_idx.data spambase.spec spambase.train spambase_idx.spec 4. Now we are going to perform Nfold crossvalidation using these new spambase_idx.* files. You can look a the nfold.py script to decipher the command line args. > ../scripts/nfold.py --booster=LogLossBoost --folds=2 --data=spambase_idx.data --spec=spambase_idx.spec --rounds=50 --tree=ADD_ALL --generate k: 0 start:0 end:2300 k: 1 start:2300 end:4600 *=---------------------------------------------------------------------=-* * Fold 0 | *============ java -Xmx1000M -cp :/Users/wbeaver/Documents/workspace/jboost/dist/jboost.jar:/Users/wbeaver/Documents/workspace/jboost/lib/concurrent.jar:/Users/wbeaver/Documents/workspace/jboost/lib/jcommon-1.0.8.jar:/Users/wbeaver/Documents/workspace/jboost/lib/jfreechart-1.0.10.jar:/Users/wbeaver/Documents/workspace/jboost/lib/swing-layout-1.0.jar jboost.controller.Controller -b LogLossBoost -p 3 -a -1 -S trial0 -n trial.spec -ATreeType ADD_ALL -numRounds 50 Fileloader adding . to path. WARNING: configuration file jboost.config not found. Continuing... Found trial.spec Found trial0.train Found trial.spec Found trial0.test Booster type: jboost.booster.LogLossBoost Read 100 training examples Read 200 training examples Read 300 training examples Read 400 training examples Read 500 training examples Read 600 training examples [snip] you get the idea. 5. the results are placed in the directory ./cvdata-mm-dd-hh-mm-ss/<TREE-TYPE> 6. Now run the visualizer in the scripts. Assuming jython is not on your path, be explicit: > ~/jython2.2.1/jython ../scripts/VisualizeScores.py cvdata-mm-dd-hh-mm-ss/ADD_ALL/trial (note, this example output shows the cvdata-mm-dd-hh-mm-ss for my test run) ['cvdata-01-16-17-44-23/ADD_ALL/trial0.test.boosting.info', 'cvdata-01-16-17-44-23/ADD_ALL/trial1.test.boosting.info'] cvdata-01-16-17-44-23/ADD_ALL/trial0.test.boosting.info cvdata-01-16-17-44-23/ADD_ALL/trial1.test.boosting.info index=0, a.length=4600 index=1, a.length=4600 index=2, a.length=4600 index=3, a.length=4600 index=4, a.length=4600 index=5, a.length=4600 index=6, a.length=4600 [snip] Assuming all is setup, you will then see the GUI. 7. Select a range of examples to output for a given iteration using the slider and press the "Print Example Indices" button in the lower left corner. This will save a file called "SelectedExamples.txt" in to the directory you ran the GUI from (in this case $JBOOST_DIR/demos) Using this file, you can write a parser to drill back to your original examples. [end] --- VisualizeScores.DEMO DELETED --- |
From: william b. <wil...@us...> - 2009-01-25 05:57:51
|
Update of /cvsroot/jboost/jboost/scripts In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16407/scripts Modified Files: nfold.py Log Message: major change to outbound dirname structure. cvdata and train test splits are now nested inside datafile.fold_N folder. cvdata dirname includes year Index: nfold.py =================================================================== RCS file: /cvsroot/jboost/jboost/scripts/nfold.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** nfold.py 7 Oct 2007 02:15:35 -0000 1.6 --- nfold.py 25 Jan 2009 05:57:46 -0000 1.7 *************** *** 7,10 **** --- 7,11 ---- import getopt import shutil + import glob *************** *** 43,51 **** # XXX: put in description! ! os.system('mv *.info ./'+foldername) ! os.system('mv *.scores ./'+foldername) ! os.system('mv *.output.tree ./'+foldername) ! os.system('mv *.sampling ./'+foldername) ! os.system('mv *.log ./'+foldername) --- 44,66 ---- # XXX: put in description! ! for f in glob.glob('*.tree'): ! shutil.move(f,foldername) ! for f in glob.glob('*.info'): ! shutil.move(f,foldername) ! for f in glob.glob('*.scores'): ! shutil.move(f,foldername) ! for f in glob.glob('*.output.tree'): ! shutil.move(f,foldername) ! for f in glob.glob('*.sampling'): ! shutil.move(f,foldername) ! for f in glob.glob('*.log'): ! shutil.move(f,foldername) ! ! # os.system('mv *.tree ./'+foldername) ! # os.system('mv *.info ./'+foldername) ! # os.system('mv *.scores ./'+foldername) ! # os.system('mv *.output.tree ./'+foldername) ! # os.system('mv *.sampling ./'+foldername) ! # os.system('mv *.log ./'+foldername) *************** *** 162,166 **** # create directory for n-folds of data if (dirname == None): ! dirname= 'cvdata-' + time.strftime("%m-%d-%H-%M-%S") try: --- 177,181 ---- # create directory for n-folds of data if (dirname == None): ! dirname= datafile + ".folds_" + str(folds) try: *************** *** 189,196 **** else: adtrees=[tree] ! for treetype in adtrees: try: ! os.mkdir(treetype) except OSError: # print 'Directory '+ treetype + ' already exists.' --- 204,217 ---- else: adtrees=[tree] ! ! treedir_prefix = "cvdata-" + time.strftime("%m-%d-%y-%H-%M-%S") ! try: ! os.mkdir(treedir_prefix) ! except OSError: ! print 'Directory '+ treedir_prefix + ' already exists.' ! for treetype in adtrees: try: ! os.mkdir(os.path.join(treedir_prefix,treetype)) except OSError: # print 'Directory '+ treetype + ' already exists.' *************** *** 204,208 **** learner(treetype, k, rounds, booster) print '*=---------------------------------------------------------------------=-*' ! moveresults(treetype) --- 225,229 ---- learner(treetype, k, rounds, booster) print '*=---------------------------------------------------------------------=-*' ! moveresults(os.path.join(treedir_prefix,treetype)) |
From: william b. <wil...@us...> - 2009-01-17 03:16:41
|
Update of /cvsroot/jboost/jboost/scripts In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27885/scripts Modified Files: AddRandomIndex.py VisualizeScores.py Added Files: VisualizeScores.DEMO VisualizeScores.README AddRandomIndex.README Log Message: added commandline support, readme and demo files Index: VisualizeScores.py =================================================================== RCS file: /cvsroot/jboost/jboost/scripts/VisualizeScores.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** VisualizeScores.py 15 Sep 2008 22:24:45 -0000 1.7 --- VisualizeScores.py 17 Jan 2009 02:00:31 -0000 1.8 *************** *** 1,152 **** ! import sys,os,os.path,re,math,glob import jarray from java.util import Vector ! args = sys.argv[1:] ! #if len(args) != 1: ! # sys.exit(""" ! # Usage: VisualizeScore <info-files-path> ! # info-file-path is a directory containing files with names like trial0.test.boosting.info, trial2.train.boosting.info ... ! # Example: perform the following commands from the jboost root directory ! # <setup classpath to point to jython> ! # source scripts/setClassPath.sh ! # cd demo ! # cat spambase.test spambase.train > spambase.data ! # ../scripts/nfold.py --folds=3 --data=spambase.data --spec=spambase.spec --rounds=43 --tree=ADD_ALL --generate --booster=LogLossBoost ! # jython ../scripts/VisualizeScores.py cvdata-09-09-17-00-55/ADD_ALL/ ! # """) ! #info_path = args[0] ! ! header_p = re.compile('iteration=(\d+): elements=(\d+):') ! scoreline_p = re.compile('([-+\d.]+):\s+') #([+-1]+):') ! ! info_path = "/Users/yoavfreund/projects/jboost/demo/forVisualize/run1/" ! ! testfiles = glob.glob(info_path+"trial*.test.boosting.info") ! trainfiles = glob.glob(info_path+"trial*.train.boosting.info") ! ! #testfiles = glob.glob("/Users/yoavfreund/Downloads/dc_boost_active_output/iter?/*.test.boosting.info") ! ! #testfiles = glob.glob("/Users/yoavfreund/projects/jboost/demo/cvdata-09-09-17-00-55/ADD_ALL/trial*.test.boosting.info") ! ! print testfiles ! exampleData={} ! ! #find the iteration indices ! ! infile = open(testfiles[0],'r') ! iterList=[] ! iterDict={} ! iterationIndex=0 ! for line in infile: ! [(iter,elements)] = header_p.findall(line) ! elements = int(elements) ! ! if iterDict.has_key(iter): ! sys.exit("data file "+testfiles[0]+" has two lists corresponding to iteration "+iter) ! iterList.append(iter) ! iterDict[iter]=iterationIndex ! iterationIndex=iterationIndex+1 ! ! for count in range(elements): ! line=infile.readline() ! ! from jboost.visualization import DataSet,DataElement,HistogramFrame ! ! d=DataSet(iterList) ! d.setOutputFilename(info_path+"/selectedExamples.txt") ! ! # read the data into the Dataset data structures. ! for filename in testfiles: ! print filename ! infile = open(filename,'r') ! iterList=[]; ! for line in infile: ! [(iter,elements)] = header_p.findall(line) ! iterationIndex=iterDict[iter] ! elements = int(elements) ! ! for count in range(elements): ! line=infile.readline() ! #print line ! a = scoreline_p.findall(line) ! index=int(a[1]) ! score=float(a[3]) ! label=int(a[-1]) ! if not exampleData.has_key(index): ! exampleData[index]={"label":label, "scores":{} } ! exampleData[index]["scores"][int(iter)] = {"test":score, "train":[]} ! e=DataElement(score,index,label) ! d.addDataElement(e,iterationIndex) ! ! d.preProcessDataset() ! lowestScore = d.getMin() ! highestScore = d.getMax() ! print "lowestScore=%f, highestScore=%f\n" % (lowestScore,highestScore) ! print len(exampleData) ! for filename in trainfiles: ! print filename ! infile = open(filename,'r') for line in infile: ! [(iter,elements)] = header_p.findall(line) ! iterationIndex=iterDict[iter] elements = int(elements) ! for count in range(elements): ! line=infile.readline() ! #print line ! a = scoreline_p.findall(line) ! index=int(a[1]) ! score=float(a[3]) ! label=int(a[-1]) ! if exampleData.has_key(index): ! exampleData[index]["scores"][int(iter)]["train"].append(score) ! #else: ! #print "missing index=%d\n" % index ! ! ! iterList = exampleData[0]["scores"].keys() ! iterList.sort() ! ! fluctBins=20 ! percentage=0.05 ! barHeight=6 ! binWidth = (highestScore-lowestScore)/fluctBins ! fluct = {} ! for iter in iterList: ! fluct[iter] = [ {"trainScores":[]} for i in range(fluctBins)] ! ! for iterNo in range(len(iterList)): ! iter = iterList[iterNo] ! print "iteration %d\n" % iter ! for index in exampleData.keys(): ! testScore=exampleData[index]["scores"][iter]["test"] ! bin = int((testScore-lowestScore)/binWidth) ! bin = min(bin,fluctBins-1) ! for trainScore in exampleData[index]["scores"][iter]["train"]: ! fluct[iter][bin]["trainScores"].append(trainScore) ! ! y=0 ! for bin in range(fluctBins): ! fluct[iter][bin]["trainScores"].sort() ! n=len(fluct[iter][bin]["trainScores"]) ! if n>10: ! bottom = fluct[iter][bin]["trainScores"][int(n*percentage)] ! top = fluct[iter][bin]["trainScores"][int(n*(1-percentage))] ! yMax = y ! yMin = y-barHeight ! y=y-1.1*barHeight ! fluct[iter][bin]["bottom"] = bottom ! fluct[iter][bin]["top"]=top ! fluct[iter][bin]["yMin"]=yMin ! fluct[iter][bin]["yMax"]=yMax ! ! print "[%f,%f] -> [%f,%f] X [%f,%f]\n" % (lowestScore+bin*binWidth,lowestScore+(bin+1)*binWidth,bottom,top,yMin,yMax) ! d.addFluctItems(iterNo, lowestScore+bin*binWidth, lowestScore+(bin+1)*binWidth, bottom, top, yMin, yMax) ! fluct[iter][bin]["trainScores"] = [] ! ! v=HistogramFrame(d) ! v.show() --- 1,163 ---- ! import sys, os, os.path, re, math, glob import jarray from java.util import Vector ! def usage(): ! print("Usage: VisualizeScores <info-files-path>") ! print("info-file-path is a directory containing files with names like trial0.test.boosting.info, trial2.train.boosting.info ...") ! print("Example: perform the following commands from the jboost root directory") ! print("<setup classpath to point to jython>") ! print("source scripts/setClassPath.sh") ! print("cd demo") ! print("cat spambase.test spambase.train > spambase.data") ! print("../scripts/nfold.py --folds=3 --data=spambase.data --spec=spambase.spec --rounds=43 --tree=ADD_ALL --generate --booster=LogLossBoost") ! print("jython ../scripts/VisualizeScores.py cvdata-09-09-17-00-55/ADD_ALL/trial*") ! print("") ! print("IMPORTANT NOTE: jboost should of been run on data and spec files passed through AddRandomIndex.py") ! def main(): ! args = sys.argv[1:] ! ! globpath = None ! if len(args) == 1: ! globpath = args[0] ! else: ! usage() ! sys.exit(2) ! header_p = re.compile('iteration=(\d+): elements=(\d+):') ! scoreline_p = re.compile('([-+\d.]+):\s+') #([+-1]+):') ! ! ! testfiles = glob.glob(globpath + "*.test.boosting.info") ! trainfiles = glob.glob(globpath + "*.train.boosting.info") ! ! #testfiles = glob.glob("/Users/yoavfreund/Downloads/dc_boost_active_output/iter?/*.test.boosting.info") ! ! #testfiles = glob.glob("/Users/yoavfreund/projects/jboost/demo/cvdata-09-09-17-00-55/ADD_ALL/trial*.test.boosting.info") ! ! print(testfiles) ! exampleData = {} ! ! #find the iteration indices ! ! infile = open(testfiles[0], 'r') ! iterList = [] ! iterDict = {} ! iterationIndex = 0 for line in infile: ! [(iter, elements)] = header_p.findall(line) elements = int(elements) ! ! if iterDict.has_key(iter): ! sys.exit("data file " + testfiles[0] + " has two lists corresponding to iteration " + iter) ! iterList.append(iter) ! iterDict[iter] = iterationIndex ! iterationIndex = iterationIndex + 1 ! for count in range(elements): ! line = infile.readline() ! ! from jboost.visualization import DataSet, DataElement, HistogramFrame ! ! d = DataSet(iterList) ! d.setOutputFilename(globpath + "/selectedExamples.txt") ! ! # read the data into the Dataset data structures. ! for filename in testfiles: ! print(filename) ! infile = open(filename, 'r') ! iterList = []; ! for line in infile: ! [(iter, elements)] = header_p.findall(line) ! iterationIndex = iterDict[iter] ! elements = int(elements) ! ! for count in range(elements): ! line = infile.readline() ! #print line ! a = scoreline_p.findall(line) ! index = int(a[1]) ! score = float(a[3]) ! label = int(a[ - 1]) ! if not exampleData.has_key(index): ! exampleData[index] = {"label":label, "scores":{} } ! exampleData[index]["scores"][int(iter)] = {"test":score, "train":[]} ! e = DataElement(score, index, label) ! d.addDataElement(e, iterationIndex) ! ! d.preProcessDataset() ! lowestScore = d.getMin() ! highestScore = d.getMax() ! print("lowestScore=%f, highestScore=%f\n" % (lowestScore, highestScore)) ! ! print(len(exampleData)) ! ! for filename in trainfiles: ! print(filename) ! infile = open(filename, 'r') ! for line in infile: ! [(iter, elements)] = header_p.findall(line) ! iterationIndex = iterDict[iter] ! elements = int(elements) ! ! for count in range(elements): ! line = infile.readline() ! #print line ! a = scoreline_p.findall(line) ! index = int(a[1]) ! score = float(a[3]) ! label = int(a[ - 1]) ! if exampleData.has_key(index): ! exampleData[index]["scores"][int(iter)]["train"].append(score) ! #else: ! #print "missing index=%d\n" % index ! ! ! # changed first index below from 0 to exampleData.keys()[0] : by boyko ! iterList = exampleData[exampleData.keys()[0]]["scores"].keys() ! iterList.sort() ! ! fluctBins = 20 ! percentage = 0.05 ! barHeight = 6 ! binWidth = (highestScore - lowestScore) / fluctBins ! fluct = {} ! for iter in iterList: ! fluct[iter] = [ {"trainScores":[]} for i in range(fluctBins)] ! ! for iterNo in range(len(iterList)): ! iter = iterList[iterNo] ! print("iteration %d\n" % iter) ! for index in exampleData.keys(): ! testScore = exampleData[index]["scores"][iter]["test"] ! bin = int((testScore - lowestScore) / binWidth) ! bin = min(bin, fluctBins - 1) ! for trainScore in exampleData[index]["scores"][iter]["train"]: ! fluct[iter][bin]["trainScores"].append(trainScore) ! ! y = 0 ! for bin in range(fluctBins): ! fluct[iter][bin]["trainScores"].sort() ! n = len(fluct[iter][bin]["trainScores"]) ! if n > 10: ! bottom = fluct[iter][bin]["trainScores"][int(n * percentage)] ! top = fluct[iter][bin]["trainScores"][int(n * (1 - percentage))] ! yMax = y ! yMin = y - barHeight ! y = y - 1.1 * barHeight ! fluct[iter][bin]["bottom"] = bottom ! fluct[iter][bin]["top"] = top ! fluct[iter][bin]["yMin"] = yMin ! fluct[iter][bin]["yMax"] = yMax ! ! print("[%f,%f] -> [%f,%f] X [%f,%f]\n" % (lowestScore + bin * binWidth, lowestScore + (bin + 1) * binWidth, bottom, top, yMin, yMax)) ! d.addFluctItems(iterNo, lowestScore + bin * binWidth, lowestScore + (bin + 1) * binWidth, bottom, top, yMin, yMax) ! fluct[iter][bin]["trainScores"] = [] ! ! ! v = HistogramFrame(d) ! v.show() ! if __name__ == "__main__": ! main() --- NEW FILE: VisualizeScores.DEMO --- Score visualization demo using spambase demo data and nfold validation: Assumptions ========== 0. you have java, jython, and python installed. 1. you have downloaded the jboost dist from sourceforge.net and built jboost from source. You CANNOT use the prebuilt jboost.jar (version 1.4 or earlier) as we are using a yet-unreleased version of jboost. 2. You setup your CLASSPATH and JBOOST_DIR environment variables per the install instructions on http://jboost.sourceforge.net/install.html 3. You are running on linux or mac. Instructions are for BASH shell. Mod as appropriate for your environment. The Demo steps: we are going to do nFold validation on the spambase demo data found in $JOOST_DIR/demo. ============== 1. add some libs to your (existing) java CLASSPATH: > export CLASSPATH=$CLASSPATH:$JBOOST_DIR/lib/jcommon-1.0.8.jar:$JBOOST_DIR/lib/jfreechart-1.0.10.jar:$JBOOST_DIR/lib/swing-layout-1.0.jar 2. cd to the demo directory > cd $JBOOST_DIR/demo 3. add an index number to each row of example data and shuffle the examples. We have a python script to do this for you. > ls spam* spambase.data spambase.test spambase.spec spambase.train > ../scripts/AddRandomIndex.py spambase wrote spambase_idx.data. wrote spambase_idx.spec. > ls spam* spambase.data spambase.test spambase_idx.data spambase.spec spambase.train spambase_idx.spec 4. Now we are going to perform Nfold crossvalidation using these new spambase_idx.* files. You can look a the nfold.py script to decipher the command line args. > ../scripts/nfold.py --booster=LogLossBoost --folds=2 --data=spambase_idx.data --spec=spambase_idx.spec --rounds=50 --tree=ADD_ALL --generate k: 0 start:0 end:2300 k: 1 start:2300 end:4600 *=---------------------------------------------------------------------=-* * Fold 0 | *============ java -Xmx1000M -cp :/Users/wbeaver/Documents/workspace/jboost/dist/jboost.jar:/Users/wbeaver/Documents/workspace/jboost/lib/concurrent.jar:/Users/wbeaver/Documents/workspace/jboost/lib/jcommon-1.0.8.jar:/Users/wbeaver/Documents/workspace/jboost/lib/jfreechart-1.0.10.jar:/Users/wbeaver/Documents/workspace/jboost/lib/swing-layout-1.0.jar jboost.controller.Controller -b LogLossBoost -p 3 -a -1 -S trial0 -n trial.spec -ATreeType ADD_ALL -numRounds 50 Fileloader adding . to path. WARNING: configuration file jboost.config not found. Continuing... Found trial.spec Found trial0.train Found trial.spec Found trial0.test Booster type: jboost.booster.LogLossBoost Read 100 training examples Read 200 training examples Read 300 training examples Read 400 training examples Read 500 training examples Read 600 training examples [snip] you get the idea. 5. the results are placed in the directory ./cvdata-mm-dd-hh-mm-ss/<TREE-TYPE> 6. Now run the visualizer in the scripts. Assuming jython is not on your path, be explicit: > ~/jython2.2.1/jython ../scripts/VisualizeScores.py cvdata-mm-dd-hh-mm-ss/ADD_ALL/trial (note, this example output shows the cvdata-mm-dd-hh-mm-ss for my test run) ['cvdata-01-16-17-44-23/ADD_ALL/trial0.test.boosting.info', 'cvdata-01-16-17-44-23/ADD_ALL/trial1.test.boosting.info'] cvdata-01-16-17-44-23/ADD_ALL/trial0.test.boosting.info cvdata-01-16-17-44-23/ADD_ALL/trial1.test.boosting.info index=0, a.length=4600 index=1, a.length=4600 index=2, a.length=4600 index=3, a.length=4600 index=4, a.length=4600 index=5, a.length=4600 index=6, a.length=4600 [snip] Assuming all is setup, you will then see the GUI. 7. Select a range of examples to output for a given iteration using the slider and press the "Print Example Indices" button in the lower left corner. This will save a file called "SelectedExamples.txt" in to the directory you ran the GUI from (in this case $JBOOST_DIR/demos) Using this file, you can write a parser to drill back to your original examples. [end] --- NEW FILE: AddRandomIndex.README --- AddRandomIndex.py ================= Add a random index [0..number of examples-1] to the first column of a jboost .data file and saves a copy of the .data file suffixed with "_idx" (for example: test.data becomes test_idx.data). Also adds a new column at feature position zero to the spec file called "INDEX" with type "number". Requirements ============ * Jython or Python * boosting .data and .spec files Usage ===== Invoke the script: [user@host scripts] $ python AddRandomIndex.py <path to data/spec file stem> where <path to data/spec file stem> is the full path to the stem of your data and spec files (assume both files located in the same directory). Example ======= [user@host scripts] $ ls /Users/jsmith/boostinginfo/ mydata.data mydata.spec [user@host scripts] $ python AddRandomIndex.py /Users/jsmith/boostinginfo/mydata wrote /Users/jsmith/boostinginfo/mydata_idx.data. wrote /Users/jsmith/boostinginfo/mydata_idx.spec. [user@host scripts] $ ls /Users/jsmith/boostinginfo/ mydata.data mydata_idx.data mydata.spec mydata_idx.spec Use these new *_idx.data and *_idx.spec file as your training data for jboost (via jboost directly or as data sources for nfold.py script). Index: AddRandomIndex.py =================================================================== RCS file: /cvsroot/jboost/jboost/scripts/AddRandomIndex.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AddRandomIndex.py 11 Sep 2008 19:58:00 -0000 1.1 --- AddRandomIndex.py 17 Jan 2009 02:00:31 -0000 1.2 *************** *** 1,2 **** --- 1,15 ---- + #!/usr/bin/python + + import sys + import os.path + + def usage(): + print("Usage: AddRandomIndex.py <path to data and spec file stem name>") + print("Example: path to data and spec files are:") + print("\t/home/jsmith/myfiles/myinfo.data and /home/jsmith/myfiles/myinfo.spec") + print("Usage: AddRandomIndex.py /home/jsmith/myfiles/myinfo") + + + """ add an INDEX field to a jboost data file. INDEX is a randomly permuted number ranging *************** *** 5,34 **** an n-fold cross validation experiment. """ ! ! filename = "/Users/yoavfreund/projects/jboost/demo/spambase" ! ! datafile = open(filename+".data",'r') ! ! lines=[] ! morelines = datafile.readlines(100000) ! while len(morelines)>0: ! lines.extend(morelines) morelines = datafile.readlines(100000) ! datafile.close() ! ! length = len(lines) ! ! from random import shuffle ! shuffle(lines) ! ! newdatafile = open(filename+"I.data",'w') ! for i in range(length): ! newdatafile.write(("%d," % i)+lines[i]) ! newdatafile.close() ! --- 18,92 ---- an n-fold cross validation experiment. """ ! def main(): ! ! args = sys.argv[1:] ! abort = False ! stem_path = "" ! if len(args) == 1: ! stem_path = args[0] ! else: ! abort = True ! ! datafilepath = stem_path+".data" ! specfilepath = stem_path+".spec" ! ! if not os.path.isfile(datafilepath): ! abort = True ! print("cannot find " + datafilepath) ! ! if not os.path.isfile(specfilepath): ! abort = True ! print("cannot find " + specfilepath) ! ! if abort: ! usage() ! sys.exit(2) ! ! datafile = open(datafilepath,'r') ! ! lines=[] morelines = datafile.readlines(100000) ! while len(morelines)>0: ! lines.extend(morelines) ! morelines = datafile.readlines(100000) ! datafile.close() ! length = len(lines) ! ! from random import shuffle ! shuffle(lines) + newdatafilepath = stem_path+"_idx.data" + newdatafile = open(newdatafilepath,'w') + for i in range(length): + newdatafile.write(("%d," % i)+lines[i]) + + newdatafile.close() + print("wrote " + newdatafilepath + ".") + + # add INDEX feature to top of .spec File + spec_file = open(specfilepath,'r') + features = spec_file.readlines() + spec_file.close() + + i=0 + for idx,line in enumerate(features): + if line.startswith(('\n','exampleTerminator','attributeTerminator','maxBadExa','maxBadAtt')): + i=i+1 + else: + break + + + features.insert(i, "INDEX number\n") + + newspecfilepath = stem_path+"_idx.spec" + newspecfile = open(newspecfilepath,'w') + newspecfile.write("".join(features)) + newspecfile.close() + print("wrote " + newspecfilepath + ".") + if __name__ == "__main__": + main() --- NEW FILE: VisualizeScores.README --- VisualizeScores.py Visualize margin score distributions from training and test folds. Requirements ============ * Jython * build of jboost from current cvs src tree (NOT THE PREBUILT JBOOST.JAR VERSION 1.4) * test | train.boosting.info files which are indexed (see AddRandomIndex.py) * binary class labels (i.e. no multilabel support at this time) TERMS: $JBOOST_DIR is environment variable pointing to the root of your downloaded jboost dist. Usage ===== You must add the files from $JBOOST_DIR/lib that are not on your CLASSPATH to your CLASSPATH. If you followed the install instructions from the JBoost website, this would mean adding $JBOOST_DIR/lib/jcommon-1.0.8.jar, $JBOOST_DIR/lib/jfreechart-1.0.10.jar, and $JBOOST_DIR/lib/swing-layout-1.0.jar to the existing classpath (see example below). Once classpath is set, from command line invoke the script from Jython: [user@host jython2.2.1]$ ./jython $JBOOST_DIR/scripts/VisualizeScores.py <path to *.boosting.info files> Where <path to *.boosting.info files> is the full path to the .boosting.info files stem you would like to process. For example: /Users/jsmith/boostingdata/cvdata/ADD_ALL/trial will glob trial0.train.boosting.info, trial0.test.boosting.info, trial1.train.boosting.info, etc. Example ======= (this example is run from within Jython dist): [user@host jython2.2.1]$ export JBOOST_DIR=/Users/jsmith/workspace/jboost/ (export for a bash shell. ignore if already done) [user@host jython2.2.1]$ export CLASSPATH=$CLASSPATH:$JBOOST_DIR/lib/jcommon-1.0.8.jar:$JBOOST_DIR/lib/jfreechart-1.0.10.jar:$JBOOST_DIR/lib/swing-layout-1.0.jar (NOTE: ASSUMES you have already added jboost.jar and concurrent.jar to your classpath) [user@host jython2.2.1]$ ./jython $JBOOST_DIR/scripts/VisualizeScores.py /Users/jsmith/boostingdata/cvdata/ADD_ALL/trial After loading, parsing, and analyzing the boosting.info files, the GUI will launch. Boosting iteration shown in upper right. A histogram showing example count by boosting score for each label is predominate and in the center of the window. Sliders below the histogram allow you select lower and upper score ranges. The region within this range on the ROC curve is shown in the upper left of the window. Pressing the button in the lower left (save selected examples) will write to a file the example index and boosting score for each example within the selected range. This file is saved to the directory indicated in step 1 above. [end] |
From: Aaron A. <aa...@us...> - 2009-01-03 05:13:45
|
Update of /cvsroot/jboost/jboost/src/jboost/controller In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2442/controller Modified Files: Configuration.java Controller.java Log Message: Added python to the code output options. Index: Controller.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/controller/Controller.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Controller.java 30 Sep 2008 03:34:50 -0000 1.12 --- Controller.java 3 Jan 2009 05:13:32 -0000 1.13 *************** *** 267,270 **** --- 267,276 ---- } + // output Matlab code + String python = m_config.getPythonOutputFileName(); + if (python != null) { + generateCode(res,"Python", python, m_config.getString("pythonOutputFunction", "predict")); + } + // output java code String java= m_config.getJavaOutputFileName(); *************** *** 443,447 **** } ! System.out.println(); } --- 449,453 ---- } ! System.out.println(""); } *************** *** 674,677 **** --- 680,685 ---- else if (language.equals("MatLab")) code= predictor.toMatlab(procedureName, m_exampleDescription); + else if (language.equals("Python")) + code= predictor.toPython(procedureName, m_exampleDescription); else if (language.equals("java")) code= Index: Configuration.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/controller/Configuration.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Configuration.java 15 Aug 2008 21:38:13 -0000 1.9 --- Configuration.java 3 Jan 2009 05:13:32 -0000 1.10 *************** *** 117,120 **** --- 117,121 ---- + "\t-serialTreeOutput file.tree Java object output of adtree (can be loaded\n" + "\t at a later date)\n" + + "\t-P filename Output Python code file name (default: stem+\".output.py\"\n" + "\t-j filename Output java code file name (default: stem+\".output.java\"\n" + "\t-c filename Output C code file name (default: stem+\".output.c\")\n" *************** *** 623,626 **** --- 624,628 ---- public static final String JAVA_OUTPUT_FILENAME="javaCodeOutputFileName"; public static final String MATLAB_OUTPUT_FILENAME="matlabCodeOutputFileName"; + public static final String PYTHON_OUTPUT_FILENAME="pythonCodeOutputFileName"; public static final String SERIALIZED_OUTPUT_FILENAME="serializationOutputFileName"; public static final String SERIALIZED_INPUT="serialTreeInput"; *************** *** 663,666 **** --- 665,669 ---- addOption(JAVA_OUTPUT_FILENAME, getString("j", null)); addOption(MATLAB_OUTPUT_FILENAME, getString("m", null)); + addOption(PYTHON_OUTPUT_FILENAME, getString("P", null)); addOption(SERIALIZED_OUTPUT_FILENAME, getString("serialTreeOutput", null)); addOption(SERIALIZED_INPUT, getString("serialTreeInput", null)); *************** *** 783,786 **** --- 786,796 ---- /** + * @return Returns the name of the Python output file + */ + public String getPythonOutputFileName() { + return getString(PYTHON_OUTPUT_FILENAME); + } + + /** * @return Returns the name of the serialized output file */ |
From: Aaron A. <aa...@us...> - 2009-01-03 05:13:38
|
Update of /cvsroot/jboost/jboost/src/jboost In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2442 Modified Files: WritablePredictor.java Log Message: Added python to the code output options. Index: WritablePredictor.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/WritablePredictor.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WritablePredictor.java 16 May 2007 04:06:02 -0000 1.1.1.1 --- WritablePredictor.java 3 Jan 2009 05:13:32 -0000 1.2 *************** *** 38,41 **** --- 38,48 ---- public abstract String toMatlab(String fname, ExampleDescription exampleDescription); + + /** Produces Matlab code for this combined classifier. + * @param fname name of procedure for predicting on new data + * @param exampleDescription the description of examples + */ + public abstract String toPython(String fname, + ExampleDescription exampleDescription); } |
From: Aaron A. <aa...@us...> - 2009-01-03 05:13:38
|
Update of /cvsroot/jboost/jboost/src/jboost/examples In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2442/examples Modified Files: ExampleSet.java Log Message: Added python to the code output options. Index: ExampleSet.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/examples/ExampleSet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExampleSet.java 11 Sep 2008 21:25:45 -0000 1.3 --- ExampleSet.java 3 Jan 2009 05:13:32 -0000 1.4 *************** *** 68,72 **** break; } ! System.out.printf("ExampleSet.indexLocation=%d%n", indexLocation); } } --- 68,72 ---- break; } ! //System.out.printf("ExampleSet.indexLocation=%d%n", indexLocation); } } |
From: Aaron A. <aa...@us...> - 2009-01-03 05:13:38
|
Update of /cvsroot/jboost/jboost/src/jboost/atree In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2442/atree Modified Files: AlternatingTree.java Log Message: Added python to the code output options. Index: AlternatingTree.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/atree/AlternatingTree.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AlternatingTree.java 2 Oct 2007 02:28:06 -0000 1.2 --- AlternatingTree.java 3 Jan 2009 05:13:32 -0000 1.3 *************** *** 893,898 **** } ! private static final boolean allDefined = false; ! /* true if should assume all attributes are defined in Matlab code */ /** Converts this AlternatingTree to Matlab. Assumes that all --- 893,1087 ---- } ! /** true if should assume all attributes are defined in Matlab code */ ! private boolean allDefined = false; ! ! /** Description of all attributes */ ! private AttributeDescription[] ad = null; ! ! /** Converts this AlternatingTree to Matlab. Assumes that all ! attributes are of type number or finite. If allDefined = true ! then all attributes are assumed to be defined. */ ! public String toPython(String fname, ! ExampleDescription exampleDescription) { ! allDefined = true; ! String code = ""; ! code += "# The map from index to spec file description is:\n\n"; ! code += "# index attr.type data.type name\n" ! + "# ------------------------------------------\n"; ! ad = exampleDescription.getAttributes(); ! for (int i = 0; i < ad.length; i++) { ! String s; ! String key = ""; ! String t = ad[i].getType(); ! if (t.equals("number")) { ! s = "number Double "; ! } else if (t.equals("text")) { ! s = "text String "; ! } else if (t.equals("finite")) { ! s = "finite Integer "; ! for (int j = 0; j < ad[i].getNoOfValues(); j++) ! key += (j == 0 ! ? "# key: " ! : "# ") ! + padInteger(j, 5) + " = " ! + ad[i].getAttributeValue(j) + "\n"; ! } else { ! System.err.println("Warning: unrecognized type for attribute " ! + i + ": " + t); ! s = "??? ??? "; ! } ! code += "# " + padInteger(i, 5) + " " + s + " " + ! ad[i].getAttributeName() + "\n" + key; ! } ! code += "" ! + "#return an array of scores correpsonding to the classes:\n" ! + "# index class name\n" ! + "# ------------------------\n"; ! AttributeDescription la = exampleDescription.getLabelDescription(); ! ! for (int j = 0; j < la.getNoOfValues(); j++) ! code += "# " + padInteger(j, 5) + " " ! + la.getAttributeValue(j) + "\n"; ! ! code += "\n\n" ! + "# This class evaluates a jboost-trained classifier. The " ! + (allDefined ? "" : "first ") + "\n" ! + "# argument is an array of values corresponding to the formatted data\n" ! + "# used during training." ! + (allDefined ! ? "\n" ! : " The second argument is an array of values\n" ! + "# indicating which of the attributes are defined (where non-zero means\n" ! + "# that the corresponding attribute is defined).\n") ! + "# This classifier was automatically generated by jboost on:\n" ! + "# " + (new Date()) + "\n" ! + "class ATree:\n" ! + "\t\"\"\"\n" ! + "\tThe ATree class provides access to scoring algorithms" ! + "\tderived from an ATree data structure. This class only\n" ! + "\tprovides scores and does not learn the structure.\n" ! + "\t\"\"\"\n" ! + "\t\n" ! + "\tdef __init__(self, datafile, specfile):\n" ! + "\t\tself.datafile = datafile\n" ! + "\t\tself.specfile = specfile\n" ! + "\t\tself.data = self.__read_in_data()\n" ! + "\t\tself.spec_dict = self.__read_in_spec()\n" ! + "\t\n" ! + "\tdef get_scores(self):\n" ! + "\t\tret = []\n" ! + "\t\tfor i,x in enumerate(self.data):\n" ! + "\t\t\tret.append(self.__score(i))\n" ! + "\t\treturn ret\n" ! + "\t\n" ! + "\tdef __score(self, i):\n" ! + "\t\treturn self.__predict(i)\n" ! + "\t\n" ! + "\tdef get_data_value(self, x, feature):\n" ! + "\t\tidx = self.spec_dict[feature]\n" ! + "\t\treturn float(x[idx])\n" ! + "\t\n" ! + "\tdef __read_in_data(self):\n" ! + "\t\t\"\"\"\n" ! + "\t\tReads in the datafile.\n" ! + "\t\t\"\"\"\n" ! + "\t\tf = open(self.datafile)\n" ! + "\t\tlines = f.readlines()\n" ! + "\t\tf.close()\n" ! + "\t\tret = []\n" ! + "\t\tfor line in lines:\n" ! + "\t\t\tline = line[:-2]\n" ! + "\t\t\tret.append([x.strip() for x in line.split(',')])\n" ! + "\t\treturn ret\n" ! + "\t\n" ! + "\tdef __read_in_spec(self):\n" ! + "\t\t\"\"\"\n" ! + "\t\tReturns a dictionary with feature names => data index\n" ! + "\t\t\"\"\"\n" ! + "\t\tf = open(self.specfile)\n" ! + "\t\tlines = f.readlines()\n" ! + "\t\tf.close()\n" ! + "\t\tret = {}\n" ! + "\t\ti = 0\n" ! + "\t\tfor line in lines:\n" ! + "\t\t\tif '=' in line:\n" ! + "\t\t\t\tcontinue\n" ! + "\t\t\tdescription = line.split()[0]\n" ! + "\t\t\tret[description] = i\n" ! + "\t\t\ti += 1\n" ! + "\t\treturn ret\n" ! + "\t\n" ! + "\tdef __predict(self, i" ! + (allDefined ? "" : ", def") + "):\n" ! + "\t\tx=self.data[i]\n" ! + "\t\tpred = [0 for i in range(" + root.prediction.toCodeArray().length + ")]\n" ! + makePythonCode(root, "\t\t") ! + "\t\treturn pred" ! + "\n" ! + "\n" ! + "import sys\n" ! + "def main():\n" ! + "\tdatafile = sys.argv[1]\n" ! + "\tspecfile = sys.argv[2]\n" ! + "\tatree = ATree(datafile, specfile)\n" ! + "\tscores = atree.get_scores()\n" ! + "\tprint scores\n" ! + "if __name__=='__main__':\n" ! + "\tmain()\n" ! + "\n" ! + "\n"; ! return code; ! } ! ! ! private String makePythonCode(PredictorNode pn, String tab) { ! String code = ""; ! code += tab + "newpred = [ # " + pn.id + "\n"; ! double[] v = pn.prediction.toCodeArray(); ! for (int i = 0; i < v.length; i++) ! code += tab + " " + v[i] + ! (i < v.length - 1 ? "\n" : "]\n"); ! code += tab + "pred = [n+p for n,p in zip(newpred,pred)]\n"; ! int size = pn.splitterNodes.size(); ! for (int i = 0; i < size; i++) ! code += makePythonCode((SplitterNode)pn.splitterNodes.get(i), tab); ! return code; ! } ! ! private String makePythonCode(SplitterNode sn, String tab) { ! String code = ""; ! ! Summary summary=sn.splitter.getSummary(); ! ! code += tab + (allDefined ! ? " " ! : "if def(" + (summary.index+1) + "):") ! + " # " + sn.id + "\n"; ! String stab = (allDefined ? tab : tab); ! switch(summary.type) { ! case Summary.EQUALITY: ! code += stab + "if self.get_data_value(x,'" + ad[(summary.index)].getAttributeName() + "') == " + ! ((Integer)summary.val) + ":\n"; ! code += makeMatlabCode(sn.predictorNodes[0], stab + "\t"); ! code += stab + "else:\n"; ! code += makeMatlabCode(sn.predictorNodes[1], stab + "\t"); ! break; ! case Summary.LESS_THAN: ! code += stab + "if self.get_data_value(x,'" + ad[(summary.index)].getAttributeName() + "') <= " + ! ((Double) summary.val) + ":\n"; ! code += makePythonCode(sn.predictorNodes[0], stab + "\t"); ! code += stab + "else:\n"; ! code += makePythonCode(sn.predictorNodes[1], stab + "\t"); ! break; ! default: ! throw new RuntimeException("Type of split not allowed"); ! } ! ! return code; ! } ! ! ! ! /** Converts this AlternatingTree to Matlab. Assumes that all |
From: Aaron A. <aa...@us...> - 2008-11-17 22:31:19
|
Update of /cvsroot/jboost/jboost/src/jboost/learner In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17789 Modified Files: InequalitySplitterBuilder.java Log Message: Removing cutIndex=-1 as it is redundant Index: InequalitySplitterBuilder.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/learner/InequalitySplitterBuilder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** InequalitySplitterBuilder.java 24 Jan 2008 22:48:54 -0000 1.3 --- InequalitySplitterBuilder.java 17 Nov 2008 22:31:13 -0000 1.4 *************** *** 250,254 **** } if (cutIndex==-1) { - cutIndex=-1; System.out.println(this); } --- 250,253 ---- |
From: Aaron A. <aa...@us...> - 2008-09-30 03:35:07
|
Update of /cvsroot/jboost/jboost/src/jboost/controller In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv31517 Modified Files: Controller.java Log Message: Removed double print of last iteration. When iteration logging moved to end of loop, the final log was no longer needed. Now it's been removed. --Aaron Index: Controller.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/controller/Controller.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Controller.java 16 Aug 2008 03:17:13 -0000 1.11 --- Controller.java 30 Sep 2008 03:34:50 -0000 1.12 *************** *** 70,74 **** private static final String DEFAULT_MANPAGE = "manpage"; ! private static final int DEFAULT_NUMROUNDS = 150; public static void main(String[] argv) { --- 70,74 ---- private static final String DEFAULT_MANPAGE = "manpage"; ! private static final int DEFAULT_NUMROUNDS = 100; public static void main(String[] argv) { *************** *** 444,452 **** System.out.println(); - if (Monitor.logLevel > 1) - m_monitor.logIteration( - iterNo, - m_learningTree.getCombinedPredictor(), - m_learningTree.getLastBasePredictor()); } --- 444,447 ---- |
From: Yoav F. <yf...@us...> - 2008-09-15 15:25:19
|
Update of /cvsroot/jboost/jboost/dist In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv16881/dist Modified Files: jboost.jar Log Message: VisualizeScores.py can now be used to select a range of scores at a particular iteration and output the indices of the examples whose score is in that range into a file. Index: jboost.jar =================================================================== RCS file: /cvsroot/jboost/jboost/dist/jboost.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsB4Zy9R and /tmp/cvsL1mPk0 differ |
From: Yoav F. <yf...@us...> - 2008-09-15 15:24:50
|
Update of /cvsroot/jboost/jboost/.settings In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv16557/.settings Added Files: org.eclipse.jdt.ui.prefs org.eclipse.jdt.core.prefs Log Message: VisualizeScores.py can now be used to select a range of scores at a particular iteration and output the indices of the examples whose score is in that range into a file. --- NEW FILE: org.eclipse.jdt.core.prefs --- #Mon Mar 24 18:30:47 GMT-07:00 2008 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.codeComplete.localSuffixes= org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.codeComplete.localPrefixes= org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.comment.format_comments=true org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.codeComplete.fieldSuffixes= org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.codeComplete.fieldPrefixes= org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.indentation.size=2 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.blank_lines_before_field=1 org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert eclipse.preferences.version=1 org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.codeComplete.argumentPrefixes= org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.tabulation.size=2 org.eclipse.jdt.core.codeComplete.argumentSuffixes= org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.formatter.lineSplit=80 org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= org.eclipse.jdt.core.compiler.problem.nullReference=ignore org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert --- NEW FILE: org.eclipse.jdt.ui.prefs --- #Mon Mar 24 18:30:47 GMT-07:00 2008 org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.exception.name=e formatter_settings_version=10 org.eclipse.jdt.ui.staticondemandthreshold=99 org.eclipse.jdt.ui.overrideannotation=true org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0"?>\n<templates><template id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment" description\="Comment for getter method" context\="gettercomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * @return the ${bare_field_name}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment" description\="Comment for setter method" context\="settercomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment" description\="Comment for created constructors" context\="constructorcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * ${tags}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment" description\="Comment for created Java files" context\="filecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * \n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment" description\="Comment for created types" context\="typecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment" description\="Comment for fields" context\="fieldcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * \n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment" description\="Comment for non-overriding methods" context\="methodcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * ${tags}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment" description\="Comment for overriding methods" context\="overridecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment" description\="Comment for delegate methods" context\="delegatecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * ${tags}\n * ${see_to_target}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype" description\="Newly created files" context\="newtype_context" enabled\="true" deleted\="false" autoinsert\="true">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody" description\="Code in new class type bodies" context\="classbody_context" enabled\="true" deleted\="false" autoinsert\="true">\n</template><template id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody" description\="Code in new interface type bodies" context\="interfacebody_context" enabled\="true" deleted\="false" autoinsert\="true">\n</template><template id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody" description\="Code in new enum type bodies" context\="enumbody_context" enabled\="true" deleted\="false" autoinsert\="true">\n</template><template id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody" description\="Code in new annotation type bodies" context\="annotationbody_context" enabled\="true" deleted\="false" autoinsert\="true">\n</template><template id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock" description\="Code in new catch blocks" context\="catchblock_context" enabled\="true" deleted\="false" autoinsert\="true">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody" description\="Code in created method stubs" context\="methodbody_context" enabled\="true" deleted\="false" autoinsert\="true">// ${todo} Auto-generated method stub\n${body_statement}</template><template id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody" description\="Code in created constructor stubs" context\="constructorbody_context" enabled\="true" deleted\="false" autoinsert\="true">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody" description\="Code in created getters" context\="getterbody_context" enabled\="true" deleted\="false" autoinsert\="true">return ${field};</template><template id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody" description\="Code in created setters" context\="setterbody_context" enabled\="true" deleted\="false" autoinsert\="true">${field} \= ${param};</template></templates> org.eclipse.jdt.ui.importorder=java;javax;org;com; formatter_profile=_jboost org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.keywordthis=false eclipse.preferences.version=1 |
From: Yoav F. <yf...@us...> - 2008-09-15 15:24:49
|
Update of /cvsroot/jboost/jboost/src/jboost/visualization In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv16557/src/jboost/visualization Modified Files: DataSet.java HistogramFrame.java Log Message: VisualizeScores.py can now be used to select a range of scores at a particular iteration and output the indices of the examples whose score is in that range into a file. Index: DataSet.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/visualization/DataSet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DataSet.java 11 Sep 2008 22:49:10 -0000 1.5 --- DataSet.java 15 Sep 2008 22:24:44 -0000 1.6 *************** *** 1,16 **** package jboost.visualization; import java.util.ArrayList; - import java.util.Arrays; import java.util.Collections; - import java.util.List; import java.util.Random; - import java.util.ArrayList; - import java.util.Vector; - import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYIntervalSeries; import org.jfree.data.xy.XYSeries; - import org.jfree.data.xy.XYSeriesCollection; /** --- 1,12 ---- package jboost.visualization; + import java.io.FileOutputStream; + import java.io.PrintStream; import java.util.ArrayList; import java.util.Collections; import java.util.Random; import org.jfree.data.xy.XYIntervalSeries; import org.jfree.data.xy.XYSeries; /** *************** *** 24,27 **** --- 20,25 ---- private int iteration=0; + private String outputFilename = "ExamplesDumpFile.txt"; + /** * data is a list of ArrayLists, each list element corresponds to a (boosting) iteration, *************** *** 166,170 **** ArrayList<DataElement> iterData = data.get(iteration); for(int i=0; i<bins; i++) { ! DataElement e = binarySearch(iterData, s); //System.out.printf("label=%d, i= %d, s=%f, prev=%f, e=",label,i,s,prev); //System.out.println(e); --- 164,168 ---- ArrayList<DataElement> iterData = data.get(iteration); for(int i=0; i<bins; i++) { ! DataElement e = iterData.get(binarySearch(iterData, s)); //System.out.printf("label=%d, i= %d, s=%f, prev=%f, e=",label,i,s,prev); //System.out.println(e); *************** *** 182,189 **** } ! private DataElement binarySearch(ArrayList<DataElement> list, double s) { int l=list.size(); ! if(s<list.get(0).value) return list.get(0); ! if(s>list.get(l-1).value) return list.get(list.size()-1); double l2=Math.floor(Math.log((double) l)/Math.log(2.0)); --- 180,222 ---- } ! public void printScores(String iterName, double lowerScore, double upperScore) { ! ! PrintStream out=null; ! try{ ! // Create file ! ! FileOutputStream fstream = new FileOutputStream(outputFilename); ! out = new PrintStream(fstream); ! }catch (Exception e){//Catch exception if any ! System.err.println("Error: " + e.getMessage()); ! } ! ! out.printf("Iteration = %s, low=%f,high=%f%n", iterName,lowerScore,upperScore); ! ArrayList<DataElement> iterData = data.get(iteration); ! int i=binarySearch(iterData, lowerScore); ! DataElement e = iterData.get(i); ! if(e.value<lowerScore && i<iterData.size()) { ! i++; ! e = iterData.get(i); ! } ! while(e.value<=upperScore) { ! out.printf("%f\t%d\t%d%n",e.value,e.label,e.index); ! i++; ! if(i>=iterData.size()) break; ! e = iterData.get(i); ! } ! ! try { ! out.close(); ! } catch (Exception e1){//Catch exception if any ! System.err.println("Error: " + e1.getMessage()); ! } ! ! } ! ! private int binarySearch(ArrayList<DataElement> list, double s) { int l=list.size(); ! if(s<list.get(0).value) return 0; ! if(s>list.get(l-1).value) return list.size()-1; double l2=Math.floor(Math.log((double) l)/Math.log(2.0)); *************** *** 199,203 **** step=step/2; } ! return e; } --- 232,236 ---- step=step/2; } ! return index; } *************** *** 215,219 **** public double[] getFPTP(double v) { ! DataElement e = binarySearch(data.get(iteration),v); double[] answer = {e.falsePositives/total_neg,e.truePositives/total_pos}; return answer; --- 248,254 ---- public double[] getFPTP(double v) { ! ! ArrayList<DataElement> iterData = data.get(iteration); ! DataElement e = iterData.get(binarySearch(iterData,v)); double[] answer = {e.falsePositives/total_neg,e.truePositives/total_pos}; return answer; *************** *** 234,237 **** --- 269,276 ---- } + public void setOutputFilename(String name) { + outputFilename = name; + } + /** * @return the iterList Index: HistogramFrame.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/visualization/HistogramFrame.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HistogramFrame.java 11 Sep 2008 22:49:10 -0000 1.5 --- HistogramFrame.java 15 Sep 2008 22:24:44 -0000 1.6 *************** *** 2,5 **** --- 2,7 ---- import java.awt.Color; import java.awt.GradientPaint; + import java.awt.event.ActionEvent; + import java.awt.event.ActionListener; import java.awt.event.ComponentAdapter; import javax.swing.BorderFactory; *************** *** 7,10 **** --- 9,13 ---- import javax.swing.BoxLayout; import javax.swing.DefaultComboBoxModel; + import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JList; *************** *** 83,87 **** private int negLabel=-1; private int posLabel=+1; - private double[] negClassScores,posClassScores; private XYIntervalSeriesCollection histogramDataset; --- 86,89 ---- *************** *** 97,106 **** --- 99,112 ---- private JSplitPane jSplitPane2; private String[] iterNoList; + private static int iter; //number of current iteration entry iterNoList[iter] is the String associated with the iteration. private static double upper_limit; private static double lower_limit; + private static double upperMarkerScore,lowerMarkerScore; private static IntervalMarker histMarker; private static ValueMarker lower_tprMarker, lower_fprMarker; //markers for ROC graph + private JButton jButton1; + private JSplitPane jSplitPane3; private static ValueMarker upper_tprMarker, upper_fprMarker; //markers for ROC graph *************** *** 148,152 **** jSplitPane2.add(jList1, JSplitPane.RIGHT); jList1.setModel(jList1Model); ! jList1.setPreferredSize(new java.awt.Dimension(85, 408)); jList1.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { --- 154,163 ---- jSplitPane2.add(jList1, JSplitPane.RIGHT); jList1.setModel(jList1Model); ! jList1.setPreferredSize(new java.awt.Dimension(48, 408)); ! jList1.setFocusable(false); ! jList1.setMaximumSize(new java.awt.Dimension(30, 400)); ! jList1.setMinimumSize(new java.awt.Dimension(30, 400)); ! jList1.setIgnoreRepaint(true); ! jList1.setLocation(new java.awt.Point(30, 400)); jList1.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { *************** *** 154,158 **** if(!evt.getValueIsAdjusting()) { JList list = (JList) evt.getSource(); ! int iter = list.getSelectedIndex(); System.out.printf("jList1.valueChanged, item index=%d, id=%s%n",iter,list.getSelectedValue()); rawData.setIteration(iter); //update the rawDataSet according to the new iteration. --- 165,169 ---- if(!evt.getValueIsAdjusting()) { JList list = (JList) evt.getSource(); ! iter = list.getSelectedIndex(); System.out.printf("jList1.valueChanged, item index=%d, id=%s%n",iter,list.getSelectedValue()); rawData.setIteration(iter); //update the rawDataSet according to the new iteration. *************** *** 170,173 **** --- 181,185 ---- }); } + jSplitPane2.setFocusCycleRoot(true); } thisLayout.setVerticalGroup(thisLayout.createSequentialGroup() *************** *** 188,191 **** --- 200,204 ---- jSplitPane1.setDividerLocation(400); jSplitPane1.setDoubleBuffered(true); + jSplitPane1.setLastDividerLocation(100); { jPanel1 = new JPanel(); *************** *** 201,213 **** histogramChart = createHistogramChart(histogramDataset, fluctDataset); - double initialLocation = (upper_limit+lower_limit)/2.0; - histMarker = new IntervalMarker(initialLocation,initialLocation); - XYPlot plot = (XYPlot) histogramChart.getPlot(); - plot.addDomainMarker(histMarker, Layer.BACKGROUND); - histogramPanel = new ChartPanel(histogramChart); jPanel1.add(histogramPanel); histogramPanel.setPopupMenu(null); ! histogramPanel.setPreferredSize(new java.awt.Dimension(10, 374)); } } --- 214,221 ---- histogramChart = createHistogramChart(histogramDataset, fluctDataset); histogramPanel = new ChartPanel(histogramChart); jPanel1.add(histogramPanel); histogramPanel.setPopupMenu(null); ! histogramPanel.setPreferredSize(new java.awt.Dimension(433, 374)); } } *************** *** 221,232 **** jPanel2.setOpaque(false); { ! rocDataset = new XYSeriesCollection(); ! XYSeries rocSeries = rawData.generateRoC(negLabel,posLabel); ! rocDataset.addSeries(rocSeries); ! rocChart = createRocChart(rocDataset); ! rocPanel = new ChartPanel(rocChart); ! jPanel2.add(rocPanel); ! rocPanel.setPopupMenu(null); ! rocPanel.setPreferredSize(new java.awt.Dimension(10, 406)); } } --- 229,261 ---- jPanel2.setOpaque(false); { ! jSplitPane3 = new JSplitPane(); ! jPanel2.add(jSplitPane3); ! jSplitPane3.setPreferredSize(new java.awt.Dimension(166, 406)); ! jSplitPane3.setLastDividerLocation(100); ! jSplitPane3.setOrientation(JSplitPane.VERTICAL_SPLIT); ! jSplitPane3.setDividerLocation(350); ! { ! rocDataset = new XYSeriesCollection(); ! XYSeries rocSeries = rawData.generateRoC(negLabel,posLabel); ! rocDataset.addSeries(rocSeries); ! rocChart = createRocChart(rocDataset); ! rocPanel = new ChartPanel(rocChart); ! jSplitPane3.add(rocPanel, JSplitPane.TOP); ! rocPanel.setPopupMenu(null); ! rocPanel.setPreferredSize(new java.awt.Dimension(10, 406)); ! } ! { ! jButton1 = new JButton(); ! jSplitPane3.add(jButton1, JSplitPane.BOTTOM); ! jButton1.setText("Print Example Indices"); ! jButton1.setPreferredSize(new java.awt.Dimension(22, 22)); ! jButton1.setSize(20, 20); ! jButton1.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent evt) { ! System.out.println("jButton1.actionPerformed, event="+evt); ! rawData.printScores(iterNoList[iter], lowerMarkerScore, upperMarkerScore); ! } ! }); ! } } } *************** *** 260,267 **** private void updateUpperMarker() { int pos = (int)jSlider1.getValue(); ! double v=lower_limit+pos*(upper_limit-lower_limit)/100.0; ! histMarker.setEndValue(v); if (!jSlider1.getValueIsAdjusting()) { ! double[] FPTP = rawData.getFPTP(v); upper_fprMarker.setValue(FPTP[0]); upper_tprMarker.setValue(FPTP[1]); --- 289,296 ---- private void updateUpperMarker() { int pos = (int)jSlider1.getValue(); ! upperMarkerScore=lower_limit+pos*(upper_limit-lower_limit)/100.0; ! histMarker.setEndValue(upperMarkerScore); if (!jSlider1.getValueIsAdjusting()) { ! double[] FPTP = rawData.getFPTP(upperMarkerScore); upper_fprMarker.setValue(FPTP[0]); upper_tprMarker.setValue(FPTP[1]); *************** *** 271,278 **** private void updateLowerMarker() { int pos = (int)jSlider2.getValue(); ! double v=lower_limit+pos*(upper_limit-lower_limit)/100.0; ! histMarker.setStartValue(v); if (!jSlider2.getValueIsAdjusting()) { ! double[] FPTP = rawData.getFPTP(v); lower_fprMarker.setValue(FPTP[0]); lower_tprMarker.setValue(FPTP[1]); --- 300,307 ---- private void updateLowerMarker() { int pos = (int)jSlider2.getValue(); ! lowerMarkerScore=lower_limit+pos*(upper_limit-lower_limit)/100.0; ! histMarker.setStartValue(lowerMarkerScore); if (!jSlider2.getValueIsAdjusting()) { ! double[] FPTP = rawData.getFPTP(lowerMarkerScore); lower_fprMarker.setValue(FPTP[0]); lower_tprMarker.setValue(FPTP[1]); *************** *** 328,335 **** renderer1.setSeriesPaint(1,Color.red); renderer1.setUseYInterval(true); ! XYPlot histPlot = new XYPlot(histogramDataset, ! null, ! new NumberAxis("count"), ! renderer1); XYBarRenderer renderer2 = new XYBarRenderer(); --- 357,364 ---- renderer1.setSeriesPaint(1,Color.red); renderer1.setUseYInterval(true); ! XYPlot histPlot = new XYPlot(histogramDataset, ! null, ! new NumberAxis("count"), ! renderer1); XYBarRenderer renderer2 = new XYBarRenderer(); *************** *** 337,345 **** renderer2.setSeriesPaint(1, Color.orange); renderer2.setUseYInterval(true); ! XYPlot fluctPlot = new XYPlot(fluctDataset, ! null, ! new NumberAxis("bin"), ! renderer2); //plot.setBackgroundPaint(Color.lightGray); //plot.setDomainGridlinePaint(Color.white); --- 366,379 ---- renderer2.setSeriesPaint(1, Color.orange); renderer2.setUseYInterval(true); ! XYPlot fluctPlot = new XYPlot(fluctDataset, ! null, ! new NumberAxis("bin"), ! renderer2); + double initialLocation = (upper_limit+lower_limit)/2.0; + histMarker = new IntervalMarker(initialLocation,initialLocation); + histPlot.addDomainMarker(histMarker, Layer.BACKGROUND); + fluctPlot.addDomainMarker(histMarker, Layer.BACKGROUND); + //plot.setBackgroundPaint(Color.lightGray); //plot.setDomainGridlinePaint(Color.white); |
From: Yoav F. <yf...@us...> - 2008-09-15 15:24:48
|
Update of /cvsroot/jboost/jboost/scripts In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv16557/scripts Modified Files: VisualizeScores.py Log Message: VisualizeScores.py can now be used to select a range of scores at a particular iteration and output the indices of the examples whose score is in that range into a file. Index: VisualizeScores.py =================================================================== RCS file: /cvsroot/jboost/jboost/scripts/VisualizeScores.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** VisualizeScores.py 11 Sep 2008 21:25:45 -0000 1.6 --- VisualizeScores.py 15 Sep 2008 22:24:45 -0000 1.7 *************** *** 21,25 **** scoreline_p = re.compile('([-+\d.]+):\s+') #([+-1]+):') ! info_path = "/Users/yoavfreund/projects/jboost/demo/cvdata-09-10-13-54-55/ADD_ALL/" testfiles = glob.glob(info_path+"trial*.test.boosting.info") --- 21,25 ---- scoreline_p = re.compile('([-+\d.]+):\s+') #([+-1]+):') ! info_path = "/Users/yoavfreund/projects/jboost/demo/forVisualize/run1/" testfiles = glob.glob(info_path+"trial*.test.boosting.info") *************** *** 55,61 **** --- 55,63 ---- d=DataSet(iterList) + d.setOutputFilename(info_path+"/selectedExamples.txt") # read the data into the Dataset data structures. for filename in testfiles: + print filename infile = open(filename,'r') iterList=[]; |
From: Yoav F. <yf...@us...> - 2008-09-11 22:49:15
|
Update of /cvsroot/jboost/jboost/src/jboost/visualization In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv3536/src/jboost/visualization Modified Files: DataSet.java HistogramFrame.java Log Message: Put histogram and fluctuations bar in separate plots. Index: DataSet.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/visualization/DataSet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DataSet.java 11 Sep 2008 21:25:45 -0000 1.4 --- DataSet.java 11 Sep 2008 22:49:10 -0000 1.5 *************** *** 39,57 **** this.iterList = iterList; data = new ArrayList<ArrayList<DataElement>>(); - fluctBinSeries = new XYIntervalSeries[iterList.length]; - fluctRangeSeries = new XYIntervalSeries[iterList.length]; for(int i=0; i<iterList.length; i++) { data.add(new ArrayList<DataElement>()); fluctBinSeries[i] = new XYIntervalSeries("Bins"); fluctRangeSeries[i] = new XYIntervalSeries("Ranges"); } } - public DataSet(int size,int iterations) { data = new ArrayList<ArrayList<DataElement>>(); iterList = new String[iterations]; Random generator = new Random(12345678L); for (int iter = 0; iter<iterations; iter++) { iterList[iter] = "iteration "+iter; data.add(new ArrayList<DataElement>()); --- 39,68 ---- this.iterList = iterList; data = new ArrayList<ArrayList<DataElement>>(); for(int i=0; i<iterList.length; i++) { data.add(new ArrayList<DataElement>()); + } + initFluctSeries(iterList.length); + } + + private void initFluctSeries(int iterations) { + fluctBinSeries = new XYIntervalSeries[iterations]; + fluctRangeSeries = new XYIntervalSeries[iterations]; + for(int i=0; i<iterations; i++) { fluctBinSeries[i] = new XYIntervalSeries("Bins"); fluctRangeSeries[i] = new XYIntervalSeries("Ranges"); } + } public DataSet(int size,int iterations) { data = new ArrayList<ArrayList<DataElement>>(); iterList = new String[iterations]; + initFluctSeries(iterations); + Random generator = new Random(12345678L); for (int iter = 0; iter<iterations; iter++) { + for(int j=0; j<iter+1; j++) { + addFluctItems(iter,j*1.0,j*1.0,j*1.5+1.1,-j*1.0,-(j+1.0),-j*1.0); + } iterList[iter] = "iteration "+iter; data.add(new ArrayList<DataElement>()); Index: HistogramFrame.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/visualization/HistogramFrame.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HistogramFrame.java 11 Sep 2008 21:25:45 -0000 1.4 --- HistogramFrame.java 11 Sep 2008 22:49:10 -0000 1.5 *************** *** 32,35 **** --- 32,36 ---- import org.jfree.chart.event.PlotChangeEvent; import org.jfree.chart.event.PlotChangeListener; + import org.jfree.chart.plot.CombinedDomainXYPlot; import org.jfree.chart.plot.IntervalMarker; import org.jfree.chart.plot.Plot; *************** *** 85,88 **** --- 86,90 ---- private XYIntervalSeriesCollection histogramDataset; + private XYIntervalSeriesCollection fluctDataset; private int noOfBins=100; private JFreeChart histogramChart; *************** *** 155,159 **** System.out.printf("jList1.valueChanged, item index=%d, id=%s%n",iter,list.getSelectedValue()); rawData.setIteration(iter); //update the rawDataSet according to the new iteration. ! updateHistogramDataset(); //System.out.printf("histogramDataset has %d series%n",histogramDataset.getSeriesCount()); //histogramDataset.seriesChanged(null); --- 157,161 ---- System.out.printf("jList1.valueChanged, item index=%d, id=%s%n",iter,list.getSelectedValue()); rawData.setIteration(iter); //update the rawDataSet according to the new iteration. ! updateHistogramDatasets(); //System.out.printf("histogramDataset has %d series%n",histogramDataset.getSeriesCount()); //histogramDataset.seriesChanged(null); *************** *** 195,200 **** { histogramDataset = new XYIntervalSeriesCollection(); ! updateHistogramDataset(); ! histogramChart = createHistogramChart(histogramDataset); double initialLocation = (upper_limit+lower_limit)/2.0; --- 197,203 ---- { histogramDataset = new XYIntervalSeriesCollection(); ! fluctDataset = new XYIntervalSeriesCollection(); ! updateHistogramDatasets(); ! histogramChart = createHistogramChart(histogramDataset, fluctDataset); double initialLocation = (upper_limit+lower_limit)/2.0; *************** *** 286,293 **** ! private void updateHistogramDataset() { if(histogramDataset.getSeriesCount()>0) { histogramDataset.removeAllSeries(); } --- 289,297 ---- ! private void updateHistogramDatasets() { if(histogramDataset.getSeriesCount()>0) { histogramDataset.removeAllSeries(); + fluctDataset.removeAllSeries(); } *************** *** 308,332 **** x=x+step; } ! ! histogramDataset.addSeries(posSeries); histogramDataset.addSeries(negSeries); ! histogramDataset.addSeries(rawData.getFluctBins()); ! histogramDataset.addSeries(rawData.getFluctRanges()); } ! private static JFreeChart createHistogramChart(IntervalXYDataset dataset) { ! XYBarRenderer renderer = new XYBarRenderer(); ! renderer.setSeriesPaint(0,Color.blue); ! renderer.setSeriesPaint(1,Color.red); ! renderer.setSeriesPaint(2,Color.green); ! renderer.setSeriesPaint(3, Color.orange); ! renderer.setUseYInterval(true); ! XYPlot plot = new XYPlot(dataset, ! new NumberAxis("score"), new NumberAxis("count"), ! renderer); //plot.setBackgroundPaint(Color.lightGray); --- 312,344 ---- x=x+step; } ! histogramDataset.addSeries(posSeries); histogramDataset.addSeries(negSeries); ! fluctDataset.addSeries(rawData.getFluctBins()); ! fluctDataset.addSeries(rawData.getFluctRanges()); } ! private static JFreeChart createHistogramChart( ! IntervalXYDataset histogramDataset, ! IntervalXYDataset fluctDataset) { ! XYBarRenderer renderer1 = new XYBarRenderer(); ! renderer1.setSeriesPaint(0,Color.blue); ! renderer1.setSeriesPaint(1,Color.red); ! renderer1.setUseYInterval(true); ! XYPlot histPlot = new XYPlot(histogramDataset, ! null, new NumberAxis("count"), ! renderer1); ! ! XYBarRenderer renderer2 = new XYBarRenderer(); ! renderer2.setSeriesPaint(0,Color.green); ! renderer2.setSeriesPaint(1, Color.orange); ! renderer2.setUseYInterval(true); ! XYPlot fluctPlot = new XYPlot(fluctDataset, ! null, ! new NumberAxis("bin"), ! renderer2); //plot.setBackgroundPaint(Color.lightGray); *************** *** 334,341 **** //plot.setRangeGridlinePaint(Color.white); JFreeChart chart = new JFreeChart( "Histogram", JFreeChart.DEFAULT_TITLE_FONT, ! plot, false // legend ); --- 346,361 ---- //plot.setRangeGridlinePaint(Color.white); + CombinedDomainXYPlot combinedPlot = new CombinedDomainXYPlot(new NumberAxis("score")); + combinedPlot.setGap(10.0); + + // add the subplots... + combinedPlot.add(histPlot, 3); + combinedPlot.add(fluctPlot, 1); + combinedPlot.setOrientation(PlotOrientation.VERTICAL); + JFreeChart chart = new JFreeChart( "Histogram", JFreeChart.DEFAULT_TITLE_FONT, ! combinedPlot, false // legend ); |