Skip to content

PR draft — ControlVariateStrategy == includes base_logpdf_type (fixes issue-02) - #111

Open
docxology wants to merge 1 commit into
ReactiveBayes:mainfrom
docxology:fix/controlvariate-eq
Open

docxology wants to merge 1 commit into
ReactiveBayes:mainfrom
docxology:fix/controlvariate-eq

Conversation

@docxology

Copy link
Copy Markdown

Problem

ControlVariateStrategy(==) compares only nsamples and buffer, ignoring base_logpdf_type.

Change

srd/strategies/control_variate.jl — compare base_logpdf_type (or its getter) too.

 function Base.:(==)(a::ControlVariateStrategy, b::ControlVariateStrategy)::Bool
-    return get_nsamples(a) == get_nsamples(b) && get_buffer(a) == get_buffer(b)
+    return get_nsamples(a) == get_nsamples(b) &&
+           get_buffer(a) == get_buffer(b) &&
+           a.base_logpdf_type == b.base_logpdf_type
 end

Verification

Add a unit test: two strategies equal in nsamples/buffer but differing in base_logpdf_type are !=.

Closes #100

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MINOR] ControlVariateStrategy == ignores base_logpdf_type

1 participant