From: Aaron A. <aa...@us...> - 2007-10-13 04:32:33
|
Update of /cvsroot/jboost/jboost/src/jboost/booster In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv490/booster Modified Files: AdaBoost.java Booster.java DebugWrap.java MulticlassWrapMH.java Log Message: Fixed underflow bug in weights and outputting more information with InequalitySplitter NaN bug Index: MulticlassWrapMH.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/booster/MulticlassWrapMH.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MulticlassWrapMH.java 18 Sep 2007 03:25:58 -0000 1.4 --- MulticlassWrapMH.java 13 Oct 2007 04:32:28 -0000 1.5 *************** *** 181,184 **** --- 181,189 ---- return 0.5 * m_numLabels * m_booster.getTheoryBound(); } + + + public double getTotalWeight() { + return m_booster.getTotalWeight(); + } /** Index: Booster.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/booster/Booster.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Booster.java 18 Sep 2007 03:25:58 -0000 1.2 --- Booster.java 13 Oct 2007 04:32:28 -0000 1.3 *************** *** 73,76 **** --- 73,77 ---- public abstract double[][] getWeights(); public abstract double[][] getPotentials(); + public abstract double getTotalWeight(); public int getNumExamples(); public abstract String getParamString(); Index: AdaBoost.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/booster/AdaBoost.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AdaBoost.java 18 Sep 2007 03:25:58 -0000 1.2 --- AdaBoost.java 13 Oct 2007 04:32:28 -0000 1.3 *************** *** 201,204 **** --- 201,211 ---- } + /** + * + */ + public double getTotalWeight() { + return m_totalWeight; + } + /** *************** *** 504,512 **** public BinaryPrediction calcPrediction() { double smoothFactor= m_epsilon * m_totalWeight; ! return new BinaryPrediction( m_w[1] == m_w[0] ? 0.0 : // handle case that w0=w1=0 0.5 * Math.log((m_w[1] + smoothFactor) / (m_w[0] + smoothFactor))); } --- 511,526 ---- public BinaryPrediction calcPrediction() { double smoothFactor= m_epsilon * m_totalWeight; ! double EPS = 1e-50; ! if (Double.isNaN(smoothFactor) || (Math.abs(m_totalWeight)<EPS) || ! (Math.abs(smoothFactor)<EPS) || Double.isNaN(m_totalWeight)) { ! return new BinaryPrediction(0.0); ! } ! ! BinaryPrediction p = new BinaryPrediction( m_w[1] == m_w[0] ? 0.0 : // handle case that w0=w1=0 0.5 * Math.log((m_w[1] + smoothFactor) / (m_w[0] + smoothFactor))); + return p; } Index: DebugWrap.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/booster/DebugWrap.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DebugWrap.java 18 Sep 2007 03:25:58 -0000 1.2 --- DebugWrap.java 13 Oct 2007 04:32:28 -0000 1.3 *************** *** 147,150 **** --- 147,154 ---- } + public double getTotalWeight() { + return booster.getTotalWeight(); + } + public double[][] getPotentials(){ return new double[1][1]; |