ReactiveBayes / ReactiveBayes/ExponentialFamilyProjection.jl

[MINOR] `MLEStrategy` lacks friendly validation of empty / non-finite sample arrays (cryptic internal errors)

Open Beginner friendly
#102 0 comments 0 reactions 0 assignees View on GitHub

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[]) throws ArgumentError: reducing over an empty collection is not allowed; consider supplying init (raised deep inside Statistics.mean in MLETargetFn at src/strategies/mle.jl:89).
  • project_to(ProjectedTo(NormalMeanVariance), [NaN]) throws LinearAlgebra.PosDefException (from cholinv(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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.