From a15d666d23169dafdf01b7f5923570a9ba10787b Mon Sep 17 00:00:00 2001 From: "trevor.cohn" Date: Wed, 7 Jul 2010 14:11:42 +0000 Subject: git-svn-id: https://ws10smt.googlecode.com/svn/trunk@173 ec762483-ff6d-05da-a07a-a48fb63a330f --- .../prjava/src/phrase/PhraseObjective.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'gi/posterior-regularisation/prjava/src/phrase/PhraseObjective.java') diff --git a/gi/posterior-regularisation/prjava/src/phrase/PhraseObjective.java b/gi/posterior-regularisation/prjava/src/phrase/PhraseObjective.java index 71c91b96..b7c62261 100644 --- a/gi/posterior-regularisation/prjava/src/phrase/PhraseObjective.java +++ b/gi/posterior-regularisation/prjava/src/phrase/PhraseObjective.java @@ -20,17 +20,17 @@ import optimization.util.MathUtils; public class PhraseObjective extends ProjectedObjective{ private static final double GRAD_DIFF = 0.002; - public static double INIT_STEP_SIZE=1; - public static double VAL_DIFF=0.001; - private double c1=0.0001; - private double c2=0.9; + public static double INIT_STEP_SIZE = 10; + public static double VAL_DIFF = 0.001; // FIXME needs to be tuned + //private double c1=0.0001; // wolf stuff + //private double c2=0.9; private PhraseCluster c; /**@brief * for debugging purposes */ - public static PrintStream ps; + //public static PrintStream ps; /**@brief current phrase being optimzed*/ public int phrase; @@ -61,7 +61,7 @@ public class PhraseObjective extends ProjectedObjective{ /**@brief likelihood under p * */ - private double llh; + public double llh; public PhraseObjective(PhraseCluster cluster, int phraseIdx){ phrase=phraseIdx; @@ -181,7 +181,7 @@ public class PhraseObjective extends ProjectedObjective{ boolean succed = optimizer.optimize(this,stats,compositeStop); // System.out.println("Ended optimzation Projected Gradient Descent\n" + stats.prettyPrint(1)); if(succed){ - System.out.println("Ended optimization in " + optimizer.getCurrentIteration()); + //System.out.println("Ended optimization in " + optimizer.getCurrentIteration()); }else{ System.out.println("Failed to optimize"); } @@ -208,6 +208,10 @@ public class PhraseObjective extends ProjectedObjective{ double kl=-loglikelihood +MathUtils.dotProduct(parameters, gradient); // ps.print(", "+kl); + //System.out.println("llh " + llh); + //System.out.println("kl " + kl); + + l=l-kl; double sum=0; for(int tag=0;tag