From c7c274a7d4b0510c5cd7424704197de4aa6acde5 Mon Sep 17 00:00:00 2001 From: "trevor.cohn" Date: Tue, 13 Jul 2010 19:36:52 +0000 Subject: Changed initialisation git-svn-id: https://ws10smt.googlecode.com/svn/trunk@238 ec762483-ff6d-05da-a07a-a48fb63a330f --- gi/posterior-regularisation/prjava/src/arr/F.java | 8 +++++++- gi/posterior-regularisation/prjava/src/phrase/PhraseCluster.java | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'gi/posterior-regularisation') diff --git a/gi/posterior-regularisation/prjava/src/arr/F.java b/gi/posterior-regularisation/prjava/src/arr/F.java index 79de5d1a..2201179e 100644 --- a/gi/posterior-regularisation/prjava/src/arr/F.java +++ b/gi/posterior-regularisation/prjava/src/arr/F.java @@ -15,7 +15,7 @@ public class F { double z = 0; for (int i = 0; i < probs.length; ++i) { - probs[i] = 3 + rng.nextDouble(); + probs[i] = 1e2 + rng.nextDouble(); if (normalise) z += probs[i]; } @@ -25,6 +25,12 @@ public class F { probs[i] /= z; } + public static void uniform(double probs[]) + { + for (int i = 0; i < probs.length; ++i) + probs[i] = 1.0 / probs.length; + } + public static void l1normalize(double [] a){ double sum=0; for(int i=0;i