ReactiveBayes / ReactiveBayes/ExponentialFamilyProjection.jl
[MINOR] `ControlVariateStrategy ==` ignores `base_logpdf_type`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 11
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
[MINOR] ControlVariateStrategy == ignores base_logpdf_type
Summary
Base.:(==) for ControlVariateStrategy (src/strategies/control_variate.jl:29-31) compares only nsamples and buffer. The base_logpdf_type field (a type parameter that changes dispatch behaviour via preprocess_strategy_argument/convert(TL, ...)) is ignored, so two strategies that behave differently can compare equal.
function Base.:(==)(a::ControlVariateStrategy, b::ControlVariateStrategy)::Bool
return get_nsamples(a) == get_nsamples(b) && get_buffer(a) == get_buffer(b)
end
Impact
Low, but equality semantics are inconsistent with the strategy's actual behaviour and can mask bugs in tests/downstream code that rely on == to detect differing strategy configuration.
Suggested fix
Include get_base_logpdf_type(a) == get_base_logpdf_type(b) (add a getter or compare the fields directly) in the equality comparison.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/strategies/control_variate.jl:29-31 and inspect how base_logpdf_type is represented, including preprocess_strategy_argument and convert(TL, ...). Update the equality behavior so strategies with different base_logpdf_type values are not equal, then run the relevant project tests and verify existing equality behavior remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100