Update of /cvsroot/jboost/jboost/src/jboost/booster
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31054
Modified Files:
MixedBinaryPrediction.java
Log Message:
New normalization technique based on dt instead of exact convolution
Index: MixedBinaryPrediction.java
===================================================================
RCS file: /cvsroot/jboost/jboost/src/jboost/booster/MixedBinaryPrediction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MixedBinaryPrediction.java 2 Oct 2007 02:32:07 -0000 1.3
--- MixedBinaryPrediction.java 13 Dec 2007 07:41:39 -0000 1.4
***************
*** 5,9 ****
/**
! * A binary normalized predictor. See NoramlizedPrediction
*
* @author Aaron Arvey
--- 5,9 ----
/**
! * A binary normalized predictor. See NormalizedPrediction
*
* @author Aaron Arvey
***************
*** 11,34 ****
class MixedBinaryPrediction extends BinaryPrediction implements NormalizedPrediction{
! public MixedBinaryPrediction() {super();}
! /*
! public static boolean isNormPred(Prediction p) {
! return (p instanceof NormalizedPrediction);
}
- */
! public MixedBinaryPrediction(double p) throws NotNormalizedPredException{
super();
! if (Math.abs(p) > 1) {
! throw new NotNormalizedPredException("Prediction is unnormalized "
! + "prediction! p is: " + p);
! }
prediction=p;
}
public Object clone(){
! Object a = new MixedBinaryPrediction(prediction);
return a;
}
--- 11,36 ----
class MixedBinaryPrediction extends BinaryPrediction implements NormalizedPrediction{
! protected double deltaT;
! protected double normalizingConstant;
+ public MixedBinaryPrediction() {super();}
! public MixedBinaryPrediction(double p)
! throws NotNormalizedPredException {
! throw new NotNormalizedPredException("MixedBinaryPrediction: Need to normalize based on time!");
}
! public MixedBinaryPrediction(double p, double dt, double nc)
! throws NotNormalizedPredException {
super();
! deltaT = dt;
prediction=p;
+ normalizingConstant = nc;
}
+
+
public Object clone(){
! Object a = new MixedBinaryPrediction(prediction, deltaT);
return a;
}
***************
*** 46,54 ****
// The prediction p is for h_t
double alpha = ((MixedBinaryPrediction) p).prediction;
! prediction = (1-Math.abs(alpha)) * prediction + alpha;
if (Math.abs(alpha) > 1 || Math.abs(prediction) > 1) {
throw new NotNormalizedPredException("Prediction may result in unnormalized "
+ "prediction! p is: " + p);
}
return this;
}
--- 48,58 ----
// The prediction p is for h_t
double alpha = ((MixedBinaryPrediction) p).prediction;
! prediction = Math.exp(-dt) * prediction + alpha;
! /*
if (Math.abs(alpha) > 1 || Math.abs(prediction) > 1) {
throw new NotNormalizedPredException("Prediction may result in unnormalized "
+ "prediction! p is: " + p);
}
+ */
return this;
}
***************
*** 75,79 ****
public boolean equals(Prediction other) {
MixedBinaryPrediction bp= (MixedBinaryPrediction) other;
! return (prediction == bp.prediction);
}
--- 79,83 ----
public boolean equals(Prediction other) {
MixedBinaryPrediction bp= (MixedBinaryPrediction) other;
! return (prediction == bp.prediction && dt == bp.dt && normalizingConstant == bp.normalizingConstant);
}
***************
*** 83,87 ****
public String cPreamble() {
! System.out.println("Prediction::cPreamble not supported.");
System.exit(2);
return
--- 87,91 ----
public String cPreamble() {
! System.out.println("Prediction::cPreamble not supported for 'mixed' or normalized predictions.");
System.exit(2);
return
***************
*** 94,98 ****
public String javaPreamble() {
! System.out.println("Prediction::javaPreamble not supported.");
System.exit(2);
return ""
--- 98,102 ----
public String javaPreamble() {
! System.out.println("Prediction::javaPreamble not supported for 'mixed' or normalized predictions.");
System.exit(2);
return ""
|