@@ -29,31 +29,31 @@ def __repr__(self):
29
29
@lazy_property
30
30
def log_partition (self ):
31
31
r"""
32
- Computes the log partition function.
32
+ Computes the log partition function of the distribution :math:`p(y)` .
33
33
"""
34
34
35
35
return self .forward (LogSemiring )
36
36
37
37
@lazy_property
38
38
def marginals (self ):
39
39
r"""
40
- Computes marginals of the distribution :math:`p(y)`.
40
+ Computes marginal probabilities of the distribution :math:`p(y)`.
41
41
"""
42
42
43
43
return self .backward (self .log_partition .sum ())
44
44
45
45
@lazy_property
46
46
def max (self ):
47
47
r"""
48
- Computes the max score of distribution :math:`p(y)`.
48
+ Computes the max score of the distribution :math:`p(y)`.
49
49
"""
50
50
51
51
return self .forward (MaxSemiring )
52
52
53
53
@lazy_property
54
54
def argmax (self ):
55
55
r"""
56
- Computes :math:`\arg\max_y p(y)` of distribution :math:`p(y)`.
56
+ Computes :math:`\arg\max_y p(y)` of the distribution :math:`p(y)`.
57
57
"""
58
58
raise NotImplementedError
59
59
@@ -63,20 +63,20 @@ def mode(self):
63
63
64
64
def kmax (self , k ):
65
65
r"""
66
- Computes the k-max of distribution :math:`p(y)`.
66
+ Computes the k-max of the distribution :math:`p(y)`.
67
67
"""
68
68
69
69
return self .forward (KMaxSemiring (k ))
70
70
71
71
def topk (self , k ):
72
72
r"""
73
- Computes the k-argmax of distribution :math:`p(y)`.
73
+ Computes the k-argmax of the distribution :math:`p(y)`.
74
74
"""
75
75
raise NotImplementedError
76
76
77
77
def sample (self ):
78
78
r"""
79
- Computes structured samples from the distribution :math:`y \sim p(y)`.
79
+ Obtains a structured sample from the distribution :math:`y \sim p(y)`.
80
80
TODO: multi-sampling.
81
81
"""
82
82
@@ -85,7 +85,7 @@ def sample(self):
85
85
@lazy_property
86
86
def entropy (self ):
87
87
r"""
88
- Computes entropy :math:`H[p]` of distribution :math:`p(y)`.
88
+ Computes entropy :math:`H[p]` of the distribution :math:`p(y)`.
89
89
"""
90
90
91
91
return self .forward (EntropySemiring )
0 commit comments