Repository navigation
fix(metrics): remove extra mean divisor from alpha-zero entropy - #584
Open
Hanabi9248 wants to merge 1 commit into
Open
Hanabi9248 wants to merge 1 commit into
Hanabi9248 wants to merge 1 commit into
Conversation
Match the documented mean log deviation in the sklearn and legacy individual and between-group paths. Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For alpha=0, the documented mean log deviation is -mean(log(b/mu)). The sklearn implementation and both legacy ClassificationMetric paths divide by mu again, so positive benefits [1,2,3] return log(4/3)/6 instead of log(4/3)/3; multiplying all benefits by two halves the result again. Remove only that extra divisor in the three branches. Benefit construction, grouping, weights and other alpha branches are unchanged.
Add 12 offline regression methods with analytic constants, positive scale invariance, real BinaryLabelDataset/ClassificationMetric objects, sklearn label/group entry points, alpha1/2 and perfect-prediction controls. On main 3487791 the baseline has 10 assertion failures across seven affected methods, with five control methods passing and no runtime errors; the candidate passes all 12. Separately, all six unchanged tests in tests/test_classification_metric.py pass. Actual package initializers and full metrics modules execute with real NumPy/pandas/sklearn; no algorithm, dataset or optional dependency is stubbed.
Validated on Python3.11.16 with existing dependencies under CPU1/768MiB/16 processes/single-threaded BLAS, no installation or data download. Run: python tests/test_generalized_entropy_alpha_zero.py -v. The full repository, Adult-data sklearn suite, model-training integrations, other Python versions and optional inFairness/OptimalTransport functionality were not run. Existing optional-import warnings are retained.
This is a formula correction on positive finite benefits, with no new zero/negative-input policy. Related #214 retains the extra divisor in its proposed shared helper; these legacy lines overlap textually, but this patch does not implement its custom-benefit/weight refactor. #583 addresses separate rate-input normalization. AI assistance was used to prepare/review the patch; the test results above are actual local executions.