diff --git a/tutorials/01-gaussian-mixture-model/index.qmd b/tutorials/01-gaussian-mixture-model/index.qmd index 09ea373d7..ffa3c4dbd 100755 --- a/tutorials/01-gaussian-mixture-model/index.qmd +++ b/tutorials/01-gaussian-mixture-model/index.qmd @@ -142,8 +142,7 @@ let # μ[1] and μ[2] can switch places, so we sort the values first. chain = Array(chains[:, ["μ[1]", "μ[2]"], i]) μ_mean = vec(mean(chain; dims=1)) - # TODO: https://github.com/TuringLang/docs/issues/533 - # @assert isapprox(sort(μ_mean), μ; rtol=0.1) "Difference between estimated mean of μ ($(sort(μ_mean))) and data-generating μ ($μ) unexpectedly large!" + @assert isapprox(sort(μ_mean), μ; rtol=0.1) "Difference between estimated mean of μ ($(sort(μ_mean))) and data-generating μ ($μ) unexpectedly large!" end end ``` @@ -208,8 +207,7 @@ let # μ[1] and μ[2] can no longer switch places. Check that they've found the mean chain = Array(chains[:, ["μ[1]", "μ[2]"], i]) μ_mean = vec(mean(chain; dims=1)) - # TODO: https://github.com/TuringLang/docs/issues/533 - # @assert isapprox(sort(μ_mean), μ; rtol=0.4) "Difference between estimated mean of μ ($(sort(μ_mean))) and data-generating μ ($μ) unexpectedly large!" + @assert isapprox(sort(μ_mean), μ; rtol=0.4) "Difference between estimated mean of μ ($(sort(μ_mean))) and data-generating μ ($μ) unexpectedly large!" end end ``` @@ -349,8 +347,7 @@ let # μ[1] and μ[2] can no longer switch places. Check that they've found the mean chain = Array(chains[:, ["μ[1]", "μ[2]"], i]) μ_mean = vec(mean(chain; dims=1)) - # TODO: https://github.com/TuringLang/docs/issues/533 - # @assert isapprox(sort(μ_mean), μ; rtol=0.4) "Difference between estimated mean of μ ($(sort(μ_mean))) and data-generating μ ($μ) unexpectedly large!" + @assert isapprox(sort(μ_mean), μ; rtol=0.4) "Difference between estimated mean of μ ($(sort(μ_mean))) and data-generating μ ($μ) unexpectedly large!" end end ``` diff --git a/tutorials/09-variational-inference/index.qmd b/tutorials/09-variational-inference/index.qmd index 56acb3208..a18ed4200 100755 --- a/tutorials/09-variational-inference/index.qmd +++ b/tutorials/09-variational-inference/index.qmd @@ -155,9 +155,8 @@ var(x), mean(x) #| echo: false let v, m = (mean(rand(q, 2000); dims=2)...,) - # TODO: Fix these as they randomly fail https://github.com/TuringLang/docs/issues/533 - # @assert isapprox(v, 1.022; atol=0.1) "Mean of s (VI posterior, 1000 samples): $v" - # @assert isapprox(m, -0.027; atol=0.03) "Mean of m (VI posterior, 1000 samples): $m" + @assert isapprox(v, 1.022; atol=0.1) "Mean of s (VI posterior, 1000 samples): $v" + @assert isapprox(m, -0.027; atol=0.03) "Mean of m (VI posterior, 1000 samples): $m" end ``` diff --git a/tutorials/11-probabilistic-pca/index.qmd b/tutorials/11-probabilistic-pca/index.qmd index d46541271..258177abb 100755 --- a/tutorials/11-probabilistic-pca/index.qmd +++ b/tutorials/11-probabilistic-pca/index.qmd @@ -246,13 +246,10 @@ heatmap( We can quantitatively check the absolute magnitudes of the column average of the gap between `mat_exp` and `mat_rec`: ```{julia} -#| echo: false -# let -# diff_matrix = mat_exp .- mat_rec -# @assert abs(mean(diff_matrix[:, 4])) <= 0.5 #0.327 -# @assert abs(mean(diff_matrix[:, 5])) <= 0.5 #0.390 -# @assert abs(mean(diff_matrix[:, 6])) <= 0.5 #0.326 -# end +diff_matrix = mat_exp .- mat_rec +for col in 4:6 + @assert abs(mean(diff_matrix[:, col])) <= 0.5 +end ``` We observe that, using posterior mean, the recovered data matrix `mat_rec` has values align with the original data matrix - particularly the same pattern in the first and last 3 gene features are captured, which implies the inference and p-PCA decomposition are successful. @@ -383,4 +380,4 @@ It can also thought as a matrix factorisation method, in which $\mathbf{X}=(\mat [^2]: Probabilistic PCA by TensorFlow, "https://www.tensorflow.org/probability/examples/Probabilistic_PCA". [^3]: Gareth M. James, Daniela Witten, Trevor Hastie, Robert Tibshirani, *An Introduction to Statistical Learning*, Springer, 2013. [^4]: David Wipf, Srikantan Nagarajan, *A New View of Automatic Relevance Determination*, NIPS 2007. -[^5]: Christopher Bishop, *Pattern Recognition and Machine Learning*, Springer, 2006. \ No newline at end of file +[^5]: Christopher Bishop, *Pattern Recognition and Machine Learning*, Springer, 2006.