Skip to content

fix(metrics): remove extra mean divisor from alpha-zero entropy - #584

Open
Hanabi9248 wants to merge 1 commit into
Trusted-AI:mainfrom
Hanabi9248:codex/generalized-entropy-alpha-zero-oct25
Open

Hanabi9248 wants to merge 1 commit into
Trusted-AI:mainfrom
Hanabi9248:codex/generalized-entropy-alpha-zero-oct25

Conversation

@Hanabi9248

Copy link
Copy Markdown

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.

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>
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.

1 participant