Update of /cvsroot/jboost/jboost/src/jboost/monitor
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14582/src/jboost/monitor
Modified Files:
Monitor.java
Log Message:
log of surfing data
Index: Monitor.java
===================================================================
RCS file: /cvsroot/jboost/jboost/src/jboost/monitor/Monitor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Monitor.java 31 May 2007 10:04:04 -0000 1.4
--- Monitor.java 14 Jun 2007 16:21:13 -0000 1.5
***************
*** 10,13 ****
--- 10,14 ----
import jboost.Predictor;
import jboost.booster.Booster;
+ import jboost.booster.BrownBoost;
import jboost.controller.ControllerConfiguration;
import jboost.controller.Configuration;
***************
*** 44,47 ****
--- 45,53 ----
private String trainMarginOutputFilename;
+ /** surfing streams and varialbes */
+ private int surfPrintRate;
+ private PrintWriter surfStream; // a stream for the training data scores
+ private String surfOutputFilename;
+
/** a stream for logging resampling activity */
private PrintWriter samplingStream;
***************
*** 104,107 ****
--- 110,114 ----
trainMarginOutputFilename= outputStem + ".train.margin";
testMarginOutputFilename= outputStem + ".test.margin";
+ surfOutputFilename= outputStem + ".surfing";
samplingOutputFilename= outputStem + ".sampling";
***************
*** 136,139 ****
--- 143,147 ----
scoresPrintRate= config.getInt("a", 0);
marginPrintRate= scoresPrintRate;
+ surfPrintRate= scoresPrintRate;
if (scoresPrintRate != 0) {
trainScoresStream= new PrintWriter(new BufferedWriter(
***************
*** 155,158 ****
--- 163,171 ----
new FileWriter(testMarginOutputFilename)));
}
+ if (marginPrintRate != 0) {
+ surfStream = new PrintWriter(
+ new BufferedWriter(
+ new FileWriter(surfOutputFilename)));
+ }
afterInitTime= new Date();
infoStream.println("Init Start time = " + startTime);
***************
*** 194,197 ****
--- 207,211 ----
logScores(iter, combined, base);
logMargins(iter, combined, base);
+ logSurfing(iter, combined, base);
infoStream.println();
}
***************
*** 234,237 ****
--- 248,280 ----
}
+
+ /** output the scores distribution of the training set */
+ private void logSurfing(int iter, Predictor combined, Predictor base) {
+ if (surfPrintRate == 0 || // never print surf
+ (surfPrintRate > 0 && surfPrintRate != iter))
+ // or print surf only on iteration surfPrintRate
+ return;
+ if (surfPrintRate == -1) {
+ // print score when highest order digit in iter changes.
+ double m=
+ java.lang.Math.floor(
+ java.lang.Math.log(iter) / java.lang.Math.log(10.0));
+ int t= (int) java.lang.Math.pow(10.0, m);
+ if (iter == 0)
+ t= 1; // fix bug in "pow"
+ if ((iter % t) != 0)
+ return;
+ }
+ infoStream.print(" \t# output surf #");
+ // output training surf
+ // double m_margins[] = m_booster.getMargins(); // get m_margins from the
+ // m_booster
+
+ surfStream.println("iteration=" + iter + ", elements=" + trainSet.getExampleNo());
+ if(m_booster instanceof BrownBoost) {
+ surfStream.print(((BrownBoost)m_booster).surfingData());
+ }
+ }
+
|