Repository navigation
Conversation
|
This looks like a legitimate problem that needs solving. Pinging @lorentzenchr because I'm not sure if the proposed fix is the right thing to do, it seems quite complicated and like it reaches quite deep into the "inners" of scorers. While exploring alternatives I thought that manually (via I'm not sure what to do about that. To me it seems like adding a However, maybe Christian has some thoughts on how to solve this that he remembers from when he wrote the FIXME comment. @un1u3 thanks for reporting this and proposing a fix. For the moment I'd wait with making more changes until we hear from the above two maintainers. |
|
Duplicate of #32828 and the CI fails. However, this might give an idea for the other PR. |
fixes #33207
LogisticRegressionCVcan fail with probabilistic scorers such asneg_brier_scoreandneg_log_losswhen a cross-validation test fold does not contain all class labels.The failure occurs because
_log_reg_scoring_pathcalls the scorer without passing the full set of class labels. In this case,y_truehas fewer classes than the predicted probability matrix, causing a shape mismatch inside the scorer.Changes
_log_reg_scoring_pathto passlabels=classesto scorers that support it.labelsinto a shallow copy of the scorer’s internal keyword arguments to avoid mutating user objects.labelsonly if explicitly supported by the callable signature.Result
Prevents crashes when CV folds lack class labels.
Preserves existing scorer behavior and state.
Resolves the
FIXMEnoted in_log_reg_scoring_path.Tests