Skip to content

Implement multivariate standardized residuals#865

Draft
ElSacho wants to merge 17 commits intoscikit-learn-contrib:masterfrom
ElSacho:master
Draft

Implement multivariate standardized residuals#865
ElSacho wants to merge 17 commits intoscikit-learn-contrib:masterfrom
ElSacho:master

Conversation

@ElSacho
Copy link
Copy Markdown

@ElSacho ElSacho commented Feb 5, 2026

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #(issue)

Type of change

Please remove options that are irrelevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist

Guidelines

Quality Checks

  • Linting passes successfully: make lint
  • Typing passes successfully: make type-check
  • Unit tests pass successfully: make tests
  • Coverage is 100%: make coverage
  • When updating documentation: doc builds successfully and without warnings: make doc
  • When updating documentation: code examples in doc run successfully: make doctest

Contribution Documentation

LLM Usage

  • I used a Large Language Model (LLM) for this contribution.
  • I carefully reviewed and verified all LLM-generated content.

If you used an LLM, please provide the following details:

  • LLM used: (e.g., Mistral, Claude, GPT, Gemini, etc.)
  • Purpose: (e.g., code generation, documentation, test writing, refactoring, etc.)

@ElSacho ElSacho marked this pull request as draft February 5, 2026 15:34
@GBrelurut
Copy link
Copy Markdown
Collaborator

GBrelurut commented Mar 5, 2026

Notes concernant les points bloquants :

  • Le score a besoin d'un fonction d'apprentissage
    methode learn_score_function(X_train, y_Train, ...) : apprendre la fonction de X (matrice de covariance)
    --> cas particulier, dans ce score, il est possible d'apprendre la prédiction ponctuelle également
    -> attribut "predictor"
    -> au moment du learn_score_function if ! prefit and score.predictor --> learn with score
    La méthode marche mieux si on entraîne la matrice de covariance en même temps que le prédicteur (de moyenne), ce qui est le cas dans le code actuel, cf les y_pred dans le fit du score.
    Pour intégrer dans MAPIE l'utilisation d'un prédicteur externe pour la moyenne, cela nécessite des changements dans le .fit sur l'objet MAPIE. Ce sera à faire plus tard, après avoir une version qui marche dans le cas où le prédicteur et la matrice sont gérés dans le score.

  • implémenter get_estimation_distribution
    L'API MAPIE produit un intervalle défini par y_low, h_high en régression. Comment généraliser cela en N dimensions ?? Pas du tout trivial pour des formes qui peuvent être n'importe quoi.
    Idée : remplacer predict_interval par un predict_ellipse spécifique pour ce score.

  • Y Mutlivarié : erreur de check_y
    --> score a un attribut "multi_output"
    --> si c'est le cas _chek_y modifié dans check_fit_parameters

  • Y univarié : erreur de Pytorch
    --> fonction interne au score check_reshape(y) --> vérifie la shape et transforme au besoin.
    En fait mis un warning dans ce cas car en pratique si 1D, ne pas utiliser cette classe mais plutôt la version 1D

Autres :

  • remplacer Any par CovarianceEstimator dans covariance_estimator: Optional[CovarianceEstimator] = None

  • covariance_trainer.py dans standardized_residuals.py ou utils.py

  • déplacer contenu test_multi.py dans test_conformity_scores_bounds.py

  • déplacer contenu test_covariance_trainer.py dans test_conformity_scores_utils.py

  • notebook d'exemple dans la doc

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.

3 participants