Skip to content

Conversation

@alexmagikov
Copy link
Contributor

Implementation of the M step of the EM algorithm using the method of moments for Weibull, Exponential and Gaussian distributions

@iraedeus iraedeus requested review from Copilot and iraedeus July 26, 2025 10:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the M-step of the EM algorithm using the method of moments for Weibull, Exponential, and Gaussian distributions, providing an alternative to maximum likelihood estimation.

  • Implementation of MomentsMStep class for parameter estimation using sample moments
  • Addition of calc_moments_params methods to distribution models (Weibull, Gaussian, Exponential)
  • Comprehensive test suite covering single distributions, same distribution mixtures, and mixed distribution scenarios

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
mpest/em/methods/moments_method.py Core implementation of moments-based M-step algorithm
mpest/models/weibull.py Addition of moments-based parameter calculation for Weibull distribution
mpest/models/gaussian.py Addition of moments-based parameter calculation for Gaussian distribution
mpest/models/exponential.py Addition of moments-based parameter calculation for Exponential distribution
tests/tests_moments/moments_utils.py Utility functions for moments method testing
tests/tests_moments/test_*.py Comprehensive test suite for moments method validation
examples/*.py Minor import ordering adjustments for consistency
Comments suppressed due to low confidence (3)

tests/tests_moments/test_two_same_distributions_complex.py:103

  • Function name test_two_same_distributions_simple is misleading as this test handles complex scenarios with custom prior probabilities, not simple ones.
def test_two_same_distributions_simple(

tests/tests_moments/test_any_distributions_simple.py:67

  • Function name test is too generic and doesn't describe what the test is actually testing. It should be renamed to something more descriptive like test_any_distributions_simple.
def test(

tests/tests_moments/test_any_distributions_complex.py:78

  • Function name test is too generic and doesn't describe what the test is actually testing. It should be renamed to something more descriptive like test_any_distributions_complex.
def test(

Copy link
Collaborator

@iraedeus iraedeus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical error in tests, you have tested LMoments method, not Moments method.

@PySATL PySATL deleted a comment from Copilot AI Jul 26, 2025
@PySATL PySATL deleted a comment from Copilot AI Jul 26, 2025
@PySATL PySATL deleted a comment from Copilot AI Jul 26, 2025
@iraedeus iraedeus self-requested a review July 27, 2025 20:54
@iraedeus iraedeus merged commit 2c6dfcb into PySATL:main Jul 27, 2025
3 checks passed
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.

2 participants