Skip to content

Conversation

@Aarshpatel12
Copy link

Description

This PR implements the Weighted Least Squares (WLS) fitting algorithm using the statsmodels library, as requested in Issue #110.

Key Changes

  • New Wrapper: Added src/standardized/OSIPI_Statsmodels_WLS.py.
  • Algorithm: Implemented a segmented fitting approach:
    1. Fits D and f using RLM on high b-values (>200 s/mm²).
    2. Fits D* using RLM on the residuals (low b-values).
  • Unit Test: Added tests/IVIMmodels/unit_tests/test_OSIPI_Statsmodels_WLS.py which verifies the fitting accuracy against synthetic ground-truth data.

Dependencies

  • Requires statsmodels (standard pip package).
  • Compatible with numpy < 2.0.0 (tested with 1.26.4).

Related Issue

Fixes #110

@oliverchampion
Copy link
Collaborator

Thanks for looking into this, and taking the effort to implement it in the standardized pipeline and think about testing!
However, the coding (predominantly the placing of code) is not in line with the repository. Could you please:

  • Read the "how to commit" section on the read me
  • Contributions must be place in a folder named "Initials_Institution" under src/original, e.g. "src/original/OGC_AmsterdamUMC" --> so this is where the fit code should be
  • The fit code then can be called from main/src/standardized, but for this please copy an existing main/src/standardized implementation and adapt to your code, such that all variables are defined properly.
  • Testing has already been fully automated, and will run by adding the fit name to "main/tests/IVIMmodels/unit_tests/algorithms.json". So you can add the name there and remove custom testing.

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.

[Feature] Weighted Least Squares algorithm

2 participants