Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REFACTOR: Break down the fit method in MapieQuantileRegressor into mu… #578

Merged
merged 5 commits into from
Dec 20, 2024

Conversation

jawadhussein462
Copy link
Collaborator

Description

The objective of this PR is to refactor the fit method in the MapieQuantileRegressor class to improve readability, modularity, and restructure it so that the function can be reused in Mapie v1.

Refactor Changes in fit

  1. _initialize_fit_conformalize

    • Initializes key attributes like cv, alpha_np, and estimators_.
    • Ensures parameters are validated before proceeding.
  2. _prepare_train_calib

    • Prepares training and calibration datasets.
    • Handles validation, splitting, and formatting of inputs (X, y, sample_weight, etc.).
  3. _fit_estimators

    • Fits estimators for the specified quantile values (alpha).
    • Stores trained estimators in the estimators_ attribute.
  4. conformalize

    • Computes conformity scores based on calibration data.
    • Handles residual calculations and stores them for prediction intervals.
      .

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the contributing guidelines
  • I have updated the HISTORY.rst and AUTHORS.rst files
  • Linting passes successfully : make lint
  • Typing passes successfully : make type-check
  • Unit tests pass successfully : make tests
  • Coverage is 100% : make coverage
  • Documentation builds successfully and without warnings : make doc

@jawadhussein462 jawadhussein462 merged commit 77df567 into master Dec 20, 2024
8 checks passed
@jawadhussein462 jawadhussein462 deleted the refactor_cqr_fit branch December 20, 2024 13:51
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