Skip to content

Add ExpectationMaximization interoperability#384

Merged
lrnv merged 16 commits into
mainfrom
issue-27-em-compatibility
Jul 20, 2026
Merged

Add ExpectationMaximization interoperability#384
lrnv merged 16 commits into
mainfrom
issue-27-em-compatibility

Conversation

@lrnv

@lrnv lrnv commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • add an optional CopulasExpectationMaximizationExt package extension
  • support instance-based and weighted fit_mle for copulas
  • jointly optimize copula parameters, continuous marginal parameters, and nested mixture probabilities for SklarDist M-steps
  • enable mixtures of copulas, mixtures of SklarDist, and nested continuous mixture margins
  • reject discrete margins explicitly because their likelihood requires copula-CDF rectangle probabilities
  • exercise fitting quality, weights, validation, and numerical edge cases in the standard test suite
  • document the interoperability and its supported-margin limits with executable examples

The core fit API remains unchanged: the instance-based and weighted adapters are confined to the optional extension required by ExpectationMaximization.jl. The branch is rebased on the current main.

Compatibility

ExpectationMaximization.jl 0.2.4 is supported on Julia LTS, while the 0.3 series is supported on Julia 1.12 and later.

Related issues

Closes #27.

This also addresses the cross-package interoperability discussed in dmetivie/ExpectationMaximization.jl#8. The explicit link is included so the upstream issue receives a backlink to this implementation.

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.61%. Comparing base (09a959e) to head (09c025a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/Fitting.jl 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #384      +/-   ##
==========================================
+ Coverage   81.38%   81.61%   +0.23%     
==========================================
  Files          85       86       +1     
  Lines        5999     6064      +65     
==========================================
+ Hits         4882     4949      +67     
+ Misses       1117     1115       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

lrnv added 10 commits July 20, 2026 21:36
Parameterize supported continuous margins, nested mixture components, mixture probabilities, and copula parameters on an unconstrained scale. Optimize their complete weighted Sklar likelihood together, retain the initialized model on optimizer regressions, and reject unsupported or discrete margins explicitly.
Allocate IFM pseudo-observations with a floating promoted element type so integer samples can be fitted. Keep numerically saturated marginal CDFs inside the open unit interval before evaluating copula densities, with regressions for integer data and extreme observations.
Assert weighted likelihood improvements, unit-weight consistency, sensitivity to weights, and non-decreasing mixture likelihoods. Cover invalid dimensions and weights, parameterless copulas, integer and extreme samples, unsupported continuous margins, discrete margins, and zero mixture probabilities while keeping the sample size bounded.
Explain that Sklar components use a joint weighted likelihood, list the continuous margin parameterizations supported recursively in mixtures, and document why discrete margins require rectangle probabilities instead of the continuous copula-density factorization. Reduce example sizes to bound documentation runtime.
@lrnv
lrnv force-pushed the issue-27-em-compatibility branch from 153b2e2 to 9528729 Compare July 20, 2026 19:36
lrnv added 6 commits July 20, 2026 21:48
Remove the family-specific joint parameterization and delegate each initialized continuous margin to its own fit_mle implementation. Fit the copula afterward on promoted, open-interval pseudo-observations, retain exact weighted MLE for bare copulas, and reject discrete IFM inputs explicitly. Update the extension tests to cover delegation and validation without assuming joint-likelihood improvement.
State that SklarDist components are updated sequentially through weighted marginal fits and a weighted copula fit, despite the fit_mle interoperability hook. Document the lack of a joint-MLE monotonicity guarantee, generic margin delegation, and the explicit exclusion of discrete margins.
Keep the exact weighted joint optimization requested for Sklar components, while preserving the concrete component-vector type of rebuilt mixture margins so ExpectationMaximization can update its typed component arrays. Limit open-interval CDF clipping to the optimization objective and retain the established censored-distribution semantics of the general Sklar logpdf.
@lrnv
lrnv merged commit cc89786 into main Jul 20, 2026
4 checks passed
@lrnv
lrnv deleted the issue-27-em-compatibility branch July 20, 2026 21:03
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.

[API choices] fit_mle for insteances, _tau

2 participants