Skip to content

Commit

Permalink
remove isnothing
Browse files Browse the repository at this point in the history
  • Loading branch information
xukai92 committed Apr 30, 2020
1 parent 6aafa94 commit c440dfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions test/sampler-vec.jl
Expand Up @@ -30,9 +30,9 @@ include("common.jl")
n_chains = n_chains_list[i_test]
metric = metricT((D, n_chains))
h = Hamiltonian(metric, ℓπ, ∂ℓπ∂θ)
@test isnothing(show(metric))
@test isnothing(show(h))
@test isnothing(show(τ))
@test show(metric) == nothing
@test show(h) == nothing
@test show(τ) == nothing
# NoAdaptation
samples, stats = sample(h, τ, θ_init_list[i_test], n_samples; verbose=false)
@test mean(samples) zeros(D, n_chains) atol=RNDATOL * n_chains
Expand All @@ -50,7 +50,7 @@ include("common.jl")
),
]
τ isa HMCDA && continue
@test isnothing(show(adaptor))
@test show(adaptor) == nothing
samples, stats = sample(h, τ, θ_init_list[i_test], n_samples, adaptor, n_adapts; verbose=false, progress=false)
@test mean(samples) zeros(D, n_chains) atol=RNDATOL * n_chains
end
Expand Down
8 changes: 4 additions & 4 deletions test/sampler.jl
Expand Up @@ -36,7 +36,7 @@ end
:DiagEuclideanMetric => DiagEuclideanMetric(D),
:DenseEuclideanMetric => DenseEuclideanMetric(D),
)
@test isnothing(show(metric))
@test show(metric) == nothing
h = Hamiltonian(metric, ℓπ, ∂ℓπ∂θ)
@testset "$lfsym" for (lfsym, lf) in Dict(
:Leapfrog => Leapfrog(ϵ),
Expand All @@ -53,8 +53,8 @@ end
:(NUTS{MultinomialTS,Original}) => NUTS{MultinomialTS,ClassicNoUTurn}(lf),
:(NUTS{MultinomialTS,Generalised}) => NUTS{MultinomialTS,GeneralisedNoUTurn}(lf),
)
@test isnothing(show(h))
@test isnothing(show(τ))
@test show(h) == nothing
@test show(τ) == nothing
@testset "NoAdaptation" begin
Random.seed!(1)
samples, stats = sample(h, τ, θ_init, n_samples; verbose=false, progress=PROGRESS)
Expand All @@ -79,7 +79,7 @@ end
StepSizeAdaptor(0.8, τ.integrator),
),
)
@test isnothing(show(adaptor))
@test show(adaptor) == nothing
Random.seed!(1)
# For `MassMatrixAdaptor`, we use the pre-defined step size as the method cannot adapt the step size.
# For other adapatation methods that are able to adpat the step size, we use `find_good_stepsize`.
Expand Down

0 comments on commit c440dfd

Please sign in to comment.