← Back to Pull requests

[API] Replaced `loss`/`method` parameter combo by `scoring` #814

Closed
unknown closed this pull request without merging on Oct 06, 2026 11:43 UTC
View on GitHub
unknown unknown commented on Sep 25, 2026 14:18 UTC
Author

First of all, to help with all the modifications, I added a custom check_scoring() function that is based on sklearn's function. It accepts:

  • a string: it can be log_loss or mean_squared_error, or any other sklearn-accepted scoring string

  • a callable: a scorer created with sklearn's make_scorer() or any custom valid scorer

  • None: in that case, the method checks if the given estimator is a classifier or regressor and choose the scorer accordingly.
  • From there, I made the modifications starting on BasePerturbation. There are a few modifications here. Since our estimators are mainly there to perform feature selection, I suggest that we entirely go in that direction, and proposed to get rid of _predict() internal methods. The estimators derived from BasePerturbation work with losses provided by the scorer, so I refactored the code in that direction by reducing code repetition, and revamped the internal method _joblib_predict_one_features_group() as _joblib_score_one_feature_group(). This allows to completely get rid of LOCO.importance() since it's pure code duplication.

    LOCI is still a work in progress, but I should be able to finish this soon (I'm working on creating a private _LOCIBaselineEstimator to work with the scoring system modifications). The tests fail because of this unfinished work, but on my side, all tests are valid for BasePerturbation, PFI, CFI, and LOCO.

    I'm opening this up to start code review and talk about the modifications I suggested. The modifications are pretty important as modifications on BasePerturbation impact a lot of code, so I suggest that we start the discussion incrementally by validating modifications on the base class, and then move to subclasses.

    I haven't modified the examples yet. I think it's best that we discuss about the modifications before reporting the changes in the examples.

    Diff: 237 lines (+177 / -60) across 2 files Reviewer: jpaillard Review duration: 15685m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 237 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.327
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #814"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.2% (MEDIUM) · Higher = larger blast radius
    37.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.7% · Safe to merge
    14.7%