From: Aaron A. <aa...@us...> - 2007-05-31 10:03:26
|
Update of /cvsroot/jboost/jboost/src/jboost/booster In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6308/src/jboost/booster Modified Files: YabaBoost.java Log Message: minor improvements Index: YabaBoost.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/booster/YabaBoost.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** YabaBoost.java 16 May 2007 04:06:02 -0000 1.1.1.1 --- YabaBoost.java 31 May 2007 10:03:23 -0000 1.2 *************** *** 75,82 **** --- 75,84 ---- public YabaBoost() { super(); + /* m_c = 1; m_c1 = 2; m_c2 = 1; m_theta = 0.5; + */ } *************** *** 167,179 **** double new_margin = (1-alpha)*margin + alpha*step; ! double wj = calculateWeight(new_margin, new_time_remaining); double new_pot = calculatePotential(new_margin, new_time_remaining); double orig_pot = calculatePotential(orig_margin, orig_time_remaining); ! vars.B += wj*step; vars.E += orig_pot - new_pot; ! ! totalWeight += wj; //System.out.println("Example: " + j + ", Step: " + step + ", Margin: " + margin + ", Weight: " + wj); //System.out.println("aj: " + aj + ", dj: " + dj + ", dj^2/sd^2: " + (dj*dj/(sd*sd)) + ", bj: " + bj); --- 169,182 ---- double new_margin = (1-alpha)*margin + alpha*step; ! double new_weight = calculateWeight(new_margin, new_time_remaining); double new_pot = calculatePotential(new_margin, new_time_remaining); double orig_pot = calculatePotential(orig_margin, orig_time_remaining); ! vars.B += new_weight*step; vars.E += orig_pot - new_pot; ! vars.Potential += new_pot / m_hypPredictions.length; ! ! totalWeight += new_weight; //System.out.println("Example: " + j + ", Step: " + step + ", Margin: " + margin + ", Weight: " + wj); //System.out.println("aj: " + aj + ", dj: " + dj + ", dj^2/sd^2: " + (dj*dj/(sd*sd)) + ", bj: " + bj); *************** *** 197,201 **** --- 200,207 ---- System.err.println(""); + System.err.println(""); System.err.println("Dumping everything"); + System.err.println("% " + v.Potential + ", " + m_initialPotential); + dumpfile.println("% Avg Diff Potential, Gamma correlation"); dumpfile.println("% " + v.E + ", " + v.B); *************** *** 234,239 **** /* * If the game has a small amount of time remaining, quit now. ! * The last little bit of the game is very numerically instable. ! * As such, we avoid playing. */ if( m_s < FINISH_GAME_NOW){ --- 240,245 ---- /* * If the game has a small amount of time remaining, quit now. ! * The last little bit of the game is very numerically ! * instable. As such, we avoid playing. */ if( m_s < FINISH_GAME_NOW){ *************** *** 319,323 **** alpha = 0; ! System.out.print("\nt: " + t); double alpha_step = 0.1; while(Math.abs(alpha_step) > STEP_EPS) { --- 325,329 ---- alpha = 0; ! //System.out.print("\nt: " + t); double alpha_step = 0.1; while(Math.abs(alpha_step) > STEP_EPS) { *************** *** 325,329 **** // Increment alpha alpha += alpha_step; ! System.out.print(" alpha: " + alpha); // Deal with boundary cases, keep margin normalized --- 331,335 ---- // Increment alpha alpha += alpha_step; ! //System.out.print(" alpha: " + alpha); // Deal with boundary cases, keep margin normalized *************** *** 341,348 **** } ! System.out.print("\n(alpha:" + alpha + ", t:" + t + ") is, gamma + pot_diff = |" ! + vars.B + "| + |" + vars.E + "| = " ! + (Math.abs(vars.B) + Math.abs(vars.E))); ! // reverse t search direction if(sign(vars.E) != sign(t_step)) t_step /= -2; --- 347,353 ---- } ! System.out.format("\tYabaBoost: (alpha=%.4f, t=%.4f) -> (corr=%.6f, pot_diff=%.6f), " ! + "potential=%.6f\n", alpha, t, vars.B, vars.E, vars.Potential); ! // reverse t search direction if(sign(vars.E) != sign(t_step)) t_step /= -2; *************** *** 357,360 **** --- 362,371 ---- alpha = bs_alpha; t = bs_t; + + + System.out.format("YabaBoost: alpha=%.4f, t=%.4f, time left=%.4f, " + + "potential=%.4f\n", alpha, t, m_s, vars.Potential); + + m_oldS = m_s; *************** *** 383,387 **** double CONSTRAINT_EPS = 0.001; if (t < m_s && ! (Math.abs(vars.E)>CONSTRAINT_EPS || Math.abs(vars.B)>CONSTRAINT_EPS)) { m_s = m_oldS; --- 394,398 ---- double CONSTRAINT_EPS = 0.001; if (t < m_s && ! (Math.abs(vars.Potential-m_initialPotential)>CONSTRAINT_EPS || Math.abs(vars.B)>CONSTRAINT_EPS)) { m_s = m_oldS; *************** *** 466,472 **** --- 477,485 ---- // print all margins. + /* for (int i= 0; i < m_margins.length; i++){ System.out.println("Margin: " + (m_margins[i] >= 0 ? " " : "") + m_margins[i] ); } + */ } |