We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 50bd788 commit 71d097eCopy full SHA for 71d097e
supar/structs/tree.py
@@ -72,10 +72,10 @@ def entropy(self):
72
return self.log_partition - (self.marginals * self.scores).sum((-1, -2))
73
74
def cross_entropy(self, other):
75
- raise NotImplementedError
+ return other.log_partition - (self.marginals * other.scores).sum((-1, -2))
76
77
def kl(self, other):
78
+ return other.log_partition - self.log_partition + (self.marginals * (self.scores - other.scores)).sum((-1, -2))
79
80
def score(self, value, partial=False):
81
arcs = value
0 commit comments