From: Aaron A. <aa...@us...> - 2007-10-23 22:45:43
|
Update of /cvsroot/jboost/jboost/src/jboost/monitor In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4913/monitor Modified Files: Monitor.java Log Message: Cost sensitive boosting, new data output format Index: Monitor.java =================================================================== RCS file: /cvsroot/jboost/jboost/src/jboost/monitor/Monitor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Monitor.java 18 Sep 2007 03:25:59 -0000 1.7 --- Monitor.java 23 Oct 2007 22:45:40 -0000 1.8 *************** *** 27,30 **** --- 27,34 ---- private String outputStem; + private static final String FIELD_SEPARATOR = ": "; + private static final char SEPARATOR = ','; + + /** a high-level log of the program's progress. */ private String infoFilename; *************** *** 180,186 **** private void logBoostingTrainTest(PrintWriter boostingStream, ExampleSet tSet, int iter, Predictor combined, Predictor base) { // Output the training data ! boostingStream.println("iteration=" + iter + ! ", elements=" + tSet.size() + ! ", boosting_params=" + m_booster.getParamString() ); --- 184,190 ---- private void logBoostingTrainTest(PrintWriter boostingStream, ExampleSet tSet, int iter, Predictor combined, Predictor base) { // Output the training data ! boostingStream.println("iteration=" + iter + FIELD_SEPARATOR + ! "elements=" + tSet.size() + FIELD_SEPARATOR + ! "boosting_params=" + m_booster.getParamString() + FIELD_SEPARATOR ); *************** *** 196,200 **** } ! NumberFormat f= new DecimalFormat("0.0000"); double[] tmp = null; Boolean[] labeltmp = null; --- 200,204 ---- } ! NumberFormat f= new DecimalFormat("0.00000"); double[] tmp = null; Boolean[] labeltmp = null; *************** *** 202,250 **** for (int i=0; i < tMargin.size(); i++) { // output the example number ! boostingStream.print("[" +i + "]; "); // output the margins - boostingStream.print("["); tmp = ((double[]) tMargin.get(i)); for (j= 0; j < tmp.length; j++){ boostingStream.print(f.format(tmp[j])); if (j != tmp.length -1) ! boostingStream.print(","); } ! boostingStream.print("]; "); // output the scores - boostingStream.print("["); tmp = ((double[]) tScores.get(i)); for (j= 0; j < tmp.length; j++){ boostingStream.print(f.format(tmp[j])); if (j != tmp.length -1) ! boostingStream.print(","); } ! boostingStream.print("]; "); ! if (boostingStream.equals(trainBoostingStream)) { - // output the weights - boostingStream.print("["); for (j= 0; j < tWeights[i].length; j++){ boostingStream.print(f.format(tWeights[i][j])); if (j != tmp.length -1) ! boostingStream.print(","); } ! boostingStream.print("]; "); // output the potentials - boostingStream.print("["); for (j= 0; j < tPotentials[i].length; j++){ boostingStream.print(f.format(tPotentials[i][j])); if (j != tmp.length -1) ! boostingStream.print(","); } ! boostingStream.print("]; "); --- 206,249 ---- for (int i=0; i < tMargin.size(); i++) { // output the example number ! boostingStream.print("" + i + FIELD_SEPARATOR); // output the margins tmp = ((double[]) tMargin.get(i)); for (j= 0; j < tmp.length; j++){ boostingStream.print(f.format(tmp[j])); if (j != tmp.length -1) ! boostingStream.print(SEPARATOR); } ! boostingStream.print(FIELD_SEPARATOR); // output the scores tmp = ((double[]) tScores.get(i)); for (j= 0; j < tmp.length; j++){ boostingStream.print(f.format(tmp[j])); if (j != tmp.length -1) ! boostingStream.print(SEPARATOR); } ! boostingStream.print(FIELD_SEPARATOR); if (boostingStream.equals(trainBoostingStream)) { // output the weights for (j= 0; j < tWeights[i].length; j++){ boostingStream.print(f.format(tWeights[i][j])); if (j != tmp.length -1) ! boostingStream.print(SEPARATOR); } ! boostingStream.print(FIELD_SEPARATOR); ! // output the potentials for (j= 0; j < tPotentials[i].length; j++){ boostingStream.print(f.format(tPotentials[i][j])); if (j != tmp.length -1) ! boostingStream.print(SEPARATOR); } ! boostingStream.print(FIELD_SEPARATOR); *************** *** 253,265 **** // output the labels - boostingStream.print("["); labeltmp = ((Boolean[]) tLabelIndices.get(i)); for (j= 0; j < labeltmp.length; j++){ boostingStream.print(labeltmp[j].booleanValue() ? "+1" : "-1"); if (j != tmp.length -1) ! boostingStream.print(","); } ! boostingStream.print("]; "); ! boostingStream.println(""); } --- 252,262 ---- // output the labels labeltmp = ((Boolean[]) tLabelIndices.get(i)); for (j= 0; j < labeltmp.length; j++){ boostingStream.print(labeltmp[j].booleanValue() ? "+1" : "-1"); if (j != tmp.length -1) ! boostingStream.print(SEPARATOR); } ! boostingStream.print(FIELD_SEPARATOR); boostingStream.println(""); } |