Update of /cvsroot/jboost/jboost/src/jboost/booster
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20381/src/jboost/booster
Modified Files:
MixedBinaryPrediction.java
Log Message:
Added in warnings for the mixed binary prediction.
Index: MixedBinaryPrediction.java
===================================================================
RCS file: /cvsroot/jboost/jboost/src/jboost/booster/MixedBinaryPrediction.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** MixedBinaryPrediction.java 16 May 2007 04:06:02 -0000 1.1.1.1
--- MixedBinaryPrediction.java 14 Jun 2007 16:35:43 -0000 1.2
***************
*** 33,44 ****
* since we have symmetry (i.e. (1-x)y+y = (1-y)x+x ) we allow this operation.
*/
! public Prediction add(Prediction p) throws NotNormalizedPredException{
double other_p = ((MixedBinaryPrediction) p).prediction;
! if (Math.abs(other_p) > 1) {
throw new NotNormalizedPredException("Prediction may result in unnormalized "
+ "prediction! p is: " + p);
}
-
- prediction = (1-other_p) * prediction + other_p;
return this;
}
--- 33,43 ----
* since we have symmetry (i.e. (1-x)y+y = (1-y)x+x ) we allow this operation.
*/
! public Prediction add(Prediction p) throws NotNormalizedPredException{
double other_p = ((MixedBinaryPrediction) p).prediction;
! prediction = (1-Math.abs(prediction)) * other_p + prediction;
! if (Math.abs(other_p) > 1 || Math.abs(prediction) > 1) {
throw new NotNormalizedPredException("Prediction may result in unnormalized "
+ "prediction! p is: " + p);
}
return this;
}
***************
*** 47,52 ****
* This is not well defined for normalized predictions. However, we
* do allow it.
- *
- *
*/
public Prediction scale(double w) throws NotNormalizedPredException{
--- 46,49 ----
***************
*** 71,78 ****
public String toString() {
! return "MixedBinaryPrediction. p(1)= "+prediction;
}
public String cPreamble() {
return
"typedef double Prediction_t;\n" +
--- 68,77 ----
public String toString() {
! return "MixedBinaryPrediction. p(1)= " + prediction;
}
public String cPreamble() {
+ System.out.println("Prediction::cPreamble not supported.");
+ System.exit(2);
return
"typedef double Prediction_t;\n" +
***************
*** 84,87 ****
--- 83,88 ----
public String javaPreamble() {
+ System.out.println("Prediction::javaPreamble not supported.");
+ System.exit(2);
return ""
+ " static private double p;\n"
|