File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 80
80
# Gibbsian polar slice sampling
81
81
GibbsPolarSlice (10 ),
82
82
]
83
+ @testset " initial_params" begin
84
+ model = MultiModel (1.0 , 1.0 , [0.0 ])
85
+ θ, y = MCMCTesting. sample_joint (Random. default_rng (), model)
86
+ model′ = AbstractMCMC. LogDensityModel (@set model. y = y)
87
+
88
+ θ0 = [1.0 , 0.1 ]
89
+ chain = sample (
90
+ model,
91
+ sampler,
92
+ 10 ;
93
+ initial_params= θ0,
94
+ progress= false ,
95
+ )
96
+ @test first (chain). params == θ0
97
+ end
98
+
99
+ @testset " initial_sample" begin
100
+ rng = StableRNG (1 )
101
+ model = MultiModel (1.0 , 1.0 , [0.0 ])
102
+ θ0 = SliceSampling. initial_sample (rng, model)
103
+
104
+ rng = StableRNG (1 )
105
+ chain = sample (rng, model, sampler, 10 ; progress= false )
106
+ @test first (chain). params == θ0
107
+ end
108
+
83
109
@testset " determinism" begin
84
110
model = MultiModel (1.0 , 1.0 , [0.0 ])
85
111
θ, y = MCMCTesting. sample_joint (Random. default_rng (), model)
Original file line number Diff line number Diff line change 52
52
SliceSteppingOut (1 ),
53
53
SliceDoublingOut (1 ),
54
54
]
55
+ @testset " initialization" begin
56
+ model = UniModel ([0.0 ])
57
+ θ, y = MCMCTesting. sample_joint (Random. default_rng (), model)
58
+ model′ = AbstractMCMC. LogDensityModel (@set model. y = y)
59
+
60
+ θ0 = [1.0 ]
61
+ chain = sample (
62
+ model,
63
+ sampler,
64
+ 10 ;
65
+ initial_params= θ0,
66
+ progress= false ,
67
+ )
68
+ @test first (chain). params == θ0
69
+ end
70
+
71
+ @testset " initial_sample" begin
72
+ rng = StableRNG (1 )
73
+ model = UniModel ([0.0 ])
74
+ θ0 = SliceSampling. initial_sample (rng, model)
75
+
76
+ rng = StableRNG (1 )
77
+ chain = sample (rng, model, sampler, 10 ; progress= false )
78
+ @test first (chain). params == θ0
79
+ end
80
+
55
81
@testset " determinism" begin
56
82
model = UniModel ([0.0 ])
57
83
θ, y = MCMCTesting. sample_joint (Random. default_rng (), model)
You can’t perform that action at this time.
0 commit comments