@@ -566,40 +566,6 @@ const GDEMO_DEFAULT = DynamicPPL.TestUtils.demo_assume_observe_literal()
566566 end
567567 end
568568 end
569-
570- @testset " with AbstractVector{<:AbstractVarInfo}" begin
571- @model function linear_reg (x, y, σ= 0.1 )
572- β ~ Normal (1 , 1 )
573- for i in eachindex (y)
574- y[i] ~ Normal (β * x[i], σ)
575- end
576- end
577-
578- ground_truth_β = 2.0
579- # the data will be ignored, as we are generating samples from the prior
580- xs_train = 1 : 0.1 : 10
581- ys_train = ground_truth_β .* xs_train + rand (Normal (0 , 0.1 ), length (xs_train))
582- m_lin_reg = linear_reg (xs_train, ys_train)
583- chain = [VarInfo (m_lin_reg) for _ in 1 : 10000 ]
584-
585- # chain is generated from the prior
586- @test mean ([chain[i][@varname (β)] for i in eachindex (chain)]) ≈ 1.0 atol = 0.1
587-
588- xs_test = [10 + 0.1 , 10 + 2 * 0.1 ]
589- m_lin_reg_test = linear_reg (xs_test, fill (missing , length (xs_test)))
590- predicted_vis = DynamicPPL. predict (m_lin_reg_test, chain)
591-
592- @test size (predicted_vis) == size (chain)
593- @test Set (keys (predicted_vis[1 ])) ==
594- Set ([@varname (β), @varname (y[1 ]), @varname (y[2 ])])
595- # because β samples are from the prior, the std will be larger
596- @test mean ([
597- predicted_vis[i][@varname (y[1 ])] for i in eachindex (predicted_vis)
598- ]) ≈ 1.0 * xs_test[1 ] rtol = 0.1
599- @test mean ([
600- predicted_vis[i][@varname (y[2 ])] for i in eachindex (predicted_vis)
601- ]) ≈ 1.0 * xs_test[2 ] rtol = 0.1
602- end
603569 end
604570
605571 @testset " ProductNamedTupleDistribution sampling" begin
0 commit comments