summaryrefslogtreecommitdiff
path: root/rst_parser/arc_factored_marginals.cc
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-04-15 17:28:08 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-04-15 17:28:08 -0400
commit8d51973c21337a1633e559cd09a649265600cc4c (patch)
tree43b212e2a577d49ddee43b32aa3ef391de4cc1a6 /rst_parser/arc_factored_marginals.cc
parentc22e9248a1fa24b0255a55d21afb94a9ed3ddc22 (diff)
crf training of arc-factored dep parser
Diffstat (limited to 'rst_parser/arc_factored_marginals.cc')
-rw-r--r--rst_parser/arc_factored_marginals.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/rst_parser/arc_factored_marginals.cc b/rst_parser/arc_factored_marginals.cc
index 9851b59a..16360b0d 100644
--- a/rst_parser/arc_factored_marginals.cc
+++ b/rst_parser/arc_factored_marginals.cc
@@ -31,14 +31,18 @@ void ArcFactoredForest::EdgeMarginals(double *plog_z) {
ArcMatrix Linv = L.inverse();
if (plog_z) *plog_z = log(Linv.determinant());
RootVector rootMarginals = r.cwiseProduct(Linv.col(0));
+// ArcMatrix T = Linv;
for (int h = 0; h < num_words_; ++h) {
for (int m = 0; m < num_words_; ++m) {
- edges_(h,m).edge_prob = prob_t((m == 0 ? 0.0 : 1.0) * A(h,m) * Linv(m,m) -
- (h == 0 ? 0.0 : 1.0) * A(h,m) * Linv(m,h));
+ const double marginal = (m == 0 ? 0.0 : 1.0) * A(h,m) * Linv(m,m) -
+ (h == 0 ? 0.0 : 1.0) * A(h,m) * Linv(m,h);
+ edges_(h,m).edge_prob = prob_t(marginal);
+// T(h,m) = marginal;
}
root_edges_[h].edge_prob = prob_t(rootMarginals(h));
}
- // cerr << "ROOT MARGINALS: " << rootMarginals.transpose() << endl;
+// cerr << "ROOT MARGINALS: " << rootMarginals.transpose() << endl;
+// cerr << "M:\n" << T << endl;
}
#else