Skip to content

Conversation

@xImoZA
Copy link

@xImoZA xImoZA commented Nov 25, 2025

This PR standardizes the behavior of distributions to ensure consistent return types (scalars vs arrays) and improves the numerical stability of PDF calculations.

Changes

  • Numerical Stability: Refactored pdf methods in all distributions to calculate probability density via np.exp(lpdf(X)).
  • Standardized Outputs: Updated distribution methods (pdf, lpdf, ppf, log_gradients) to strictly distinguish between inputs:
    • Scalar input -> Scalar output.
    • Array input -> Array output with correct dtype.
  • Testing: Added comprehensive property-based tests (via Hypothesis) for all distributions ensuring that:
    • Scalar inputs return scalars (np.isscalar check).
    • Array inputs return arrays with correct shapes and dtypes.

@xImoZA xImoZA changed the base branch from refactor/rework-arch to feat(core)/switch-to-generics November 25, 2025 11:52
@xImoZA xImoZA self-assigned this Nov 25, 2025
@xImoZA xImoZA requested a review from iraedeus November 25, 2025 11:53
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.

REFACTOR: Standardize output types in distributions FIX: Handle scalar case in tests

2 participants