ReactiveBayes / ReactiveBayes/ExponentialFamilyProjection.jl
[MINOR] `MLEStrategy` lacks friendly validation of empty / non-finite sample arrays (cryptic internal errors)
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 11
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
[MINOR] MLEStrategy lacks friendly validation of empty / non-finite sample arrays (cryptic internal errors)
Summary
MLEStrategy (src/strategies/mle.jl) performs no input validation on the sample array. Degenerate inputs surface as cryptic internal errors instead of a clear user-facing message, after the solver has already started.
Evidence (Julia 1.12.6)
project_to(ProjectedTo(Beta), Float64[])throwsArgumentError: reducing over an empty collection is not allowed; consider supplying init(raised deep insideStatistics.meaninMLETargetFnatsrc/strategies/mle.jl:89).project_to(ProjectedTo(NormalMeanVariance), [NaN])throwsLinearAlgebra.PosDefException(fromcholinv(fisherinformation(...))on a NaN-poisoned iterate).
Neither error message tells the caller their input array was empty or contained NaN/Inf.
Impact
Minor — these are degenerate inputs — but the poor error surfacing can be genuinely confusing (e.g. in ReactiveMP/RxInfer wiring where an empty message array can occur through a bug elsewhere).
Suggested fix
Validate in project_to (or MLEStrategy.create_state!): reject empty and non-finite samples with a clear ArgumentError before optimization starts.
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/mle.jl, reading MLEStrategy.create_state! and the MLETargetFn code around line 89, then trace the project_to entry point. Confirm that empty or non-finite sample arrays are rejected with clear ArgumentError messages before optimization begins, rather than producing internal solver errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100