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;
}
|