-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More quick fixes. Tests pass except for docs
Docs need to be updated. Better delineation between a table and a dataframe Sampling works, inference hasent been touched
- Loading branch information
1 parent
b943e99
commit ed19c87
Showing
4 changed files
with
31 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
let | ||
# A → C ← B | ||
bn = BayesNet() | ||
push!(bn, StaticCPD(:a, Categorical([1.0,0.0]))) | ||
push!(bn, StaticCPD(:b, Categorical([0.0,1.0]))) | ||
push!(bn, CategoricalCPD{Bernoulli}(:c, [:a, :b], [2,2], [Bernoulli(0.1), Bernoulli(0.2), Bernoulli(1.0), Bernoulli(0.4)])) | ||
# A → C ← B | ||
bn = BayesNet() | ||
push!(bn, StaticCPD(:a, Categorical([1.0,0.0]))) | ||
push!(bn, StaticCPD(:b, Categorical([0.0,1.0]))) | ||
push!(bn, CategoricalCPD{Bernoulli}(:c, [:a, :b], [2,2], | ||
[Bernoulli(0.1), Bernoulli(0.2), Bernoulli(1.0), Bernoulli(0.4)])) | ||
|
||
@test rand(bn) == Dict(:a=>1, :b=>2, :c=>1) | ||
@test rand(bn) == Dict(:a=>1, :b=>2, :c=>1) | ||
|
||
t1 = rand(bn, 5) | ||
@test size(t1) == (5,3) | ||
@test t1[:a] == [1,1,1,1,1] | ||
@test t1[:b] == [2,2,2,2,2] | ||
t1 = rand(bn, 5) | ||
@test size(t1) == (5,3) | ||
@test t1[:a] == [1,1,1,1,1] | ||
@test t1[:b] == [2,2,2,2,2] | ||
|
||
t2 = rand(bn, 5, Assignment(:c=>1)) | ||
@test size(t1) == (5,3) | ||
t2 = rand(bn, 5, Assignment(:c=>1)) | ||
@test size(t1) == (5,3) | ||
|
||
t3 = rand(bn, 5, :c=>1, :b=>2) | ||
@test size(t1) == (5,3) | ||
t3 = rand(bn, 5, :c=>1, :b=>2) | ||
@test size(t1) == (5,3) | ||
|
||
t4 = rand(bn, LikelihoodWeightedSampler(bn, 10, :c=>1), 5) | ||
t4 = rand(bn, LikelihoodWeightedSampler(:c=>1), 5) | ||
# is there a test here? | ||
|
||
t5 = rand(bn, GibbsSampler(Assignment(:c=>1), burn_in=5), 5) | ||
@test t5[:a] == [1,1,1,1,1] | ||
@test t5[:b] == [2,2,2,2,2] | ||
t5 = rand(bn, GibbsSampler(Assignment(:c=>1), burn_in=5), 5) | ||
@test t5[:a] == [1,1,1,1,1] | ||
@test t5[:b] == [2,2,2,2,2] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters