Skip to content

ConfusionBalancer: fix the alpha weights in the docstring formula - #820

Merged
koaning merged 1 commit into
koaning:mainfrom
AlejandroCoronadoN:fix-confusion-balancer-formula
Aug 30, 2026
Merged

ConfusionBalancer: fix the alpha weights in the docstring formula#820
koaning merged 1 commit into
koaning:mainfrom
AlejandroCoronadoN:fix-confusion-balancer-formula

Conversation

@AlejandroCoronadoN

Copy link
Copy Markdown
Contributor

The ConfusionBalancer docstring formula has alpha and (1 - alpha) swapped relative to what predict_proba computes and to the alpha parameter description.

Docstring (before):

P(class_j) = α P(model_j) + (1-α) P(class_j | model_j) P(model_j)

Implementation (predict_proba):

(1 - self.alpha) * preds + self.alpha * preds @ self.cfm_

The alpha parameter is documented as "how much smoothing to apply", i.e. a higher alpha applies more of the confusion-matrix correction. The code matches that (alpha weights the corrected preds @ cfm_ term), so the formula's weights are the side that is wrong. This swaps them in the docstring to match the code:

P(class_j) = (1-α) P(model_j) + α P(class_j | model_j) P(model_j)

@koaning
koaning merged commit 32775af into koaning:main Aug 30, 2026
9 checks passed
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