Skip to content

Commit 0147ad6

Browse files
committed
Minor improvements to the ASIA network example
1 parent fbbd5a4 commit 0147ad6

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ makedocs(;
5555
],
5656
"Examples" => [
5757
"Overview" => "examples-overview.md",
58-
"Asia Network" => "generated/asia/main.md",
58+
"Asia Network" => "generated/asia-network/main.md",
5959
"Hard-core Lattice Gas" => "generated/hard-core-lattice-gas/main.md",
6060
],
6161
"Performance tips" => "generated/performance.md",

examples/asia/main.jl renamed to examples/asia-network/main.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ using TensorInference
5151
# Load the ASIA network model from the `asia.uai` file located in the examples
5252
# directory. See [Model file format (.uai)](@ref) for a description of the
5353
# format of this file.
54-
model = read_model_file(pkgdir(TensorInference, "examples", "asia", "asia.uai"))
54+
model = read_model_file(pkgdir(TensorInference, "examples", "asia-network", "model.uai"))
5555

5656
# ---
5757

@@ -60,8 +60,8 @@ tn = TensorNetworkModel(model)
6060

6161
# ---
6262

63-
# Calculate the partition function.
64-
# Since the factors in this model is normalized, the partition function is the same as total probability, $1$.
63+
# Calculate the partition function. Since the factors in this model are
64+
# normalized, the partition function is the same as the total probability, $1$.
6565
probability(tn) |> first
6666

6767
# ---
@@ -71,13 +71,13 @@ marginals(tn)
7171

7272
# ---
7373

74-
# Retrieve the variables associated with the tensor network model.
74+
# Retrieve all the variables in the model.
7575
get_vars(tn)
7676

7777
# ---
7878

79-
# Set an evidence: Assume that the "X-ray" result (variable 7) is positive.
80-
# Since setting an evidence may affect the contraction order of the tensor
79+
# Set the evidence: Assume that the "X-ray" result (variable 7) is positive.
80+
# Since setting the evidence may affect the contraction order of the tensor
8181
# network, recompute it.
8282
tn = TensorNetworkModel(model, evidence = Dict(7 => 0))
8383

@@ -88,8 +88,7 @@ maximum_logp(tn)
8888

8989
# ---
9090

91-
# Generate 10 samples from the probability distribution represented by the
92-
# model.
91+
# Generate 10 samples from the posterior distribution.
9392
sample(tn, 10)
9493

9594
# ---
File renamed without changes.

0 commit comments

Comments
 (0)