Skip to content

Commit 77d41d7

Browse files
committed
fix docstring
1 parent 499316d commit 77d41d7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/Core.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ end
3030

3131
Base.show(io::IO, ::MIME"text/plain", uai::UAIModel) = Base.show(io, uai)
3232
function Base.show(io::IO, uai::UAIModel)
33-
println(io, "UAIModel(nvars = $(uai.nvars), nfactors = $(length(uai.factors))")
33+
println(io, "UAIModel(nvars = $(uai.nvars), nfactors = $(length(uai.factors)))")
3434
println(io, " cards : $(uai.cards)")
3535
println(io, " factors : ")
3636
for (k, f) in enumerate(uai.factors)
@@ -180,7 +180,7 @@ chevidence(tn::TensorNetworkModel, evidence) = TensorNetworkModel(tn.vars, tn.co
180180
"""
181181
$(TYPEDSIGNATURES)
182182
183-
Evaluate the log probability of `config`.
183+
Evaluate the log probability (or partition function) of `config`.
184184
"""
185185
function log_probability(tn::TensorNetworkModel, config::Union{Dict, AbstractVector})::Real
186186
assign = config isa AbstractVector ? Dict(zip(get_vars(tn), config)) : config
@@ -190,8 +190,11 @@ end
190190
"""
191191
$(TYPEDSIGNATURES)
192192
193-
Contract the tensor network and return a probability array with its rank specified in the contraction code `tn.code`.
194-
The returned array may not be l1-normalized even if the total probability is l1-normalized, because the evidence `tn.evidence` may not be empty.
193+
Contract the tensor network and return an array of probability of evidence.
194+
Precisely speaking, the return value is the partition function, which may not be l1-normalized.
195+
196+
If the `openvars` of the input tensor networks is zero, the array rank is zero.
197+
Otherwise, the return values corresponds to marginal probabilities.
195198
"""
196199
function probability(tn::TensorNetworkModel; usecuda = false, rescale = true)::AbstractArray
197200
return tn.code(adapt_tensors(tn; usecuda, rescale)...)

0 commit comments

Comments
 (0)