sohailshk opened a new pull request, #41429: URL: https://github.com/apache/beam/pull/41429
Fixes #41232 `MajorityVote.__init__` defaulted `tie_breaker` to the constant `DEFAULT_NORMAL_LABEL` (0), although the docstring says it defaults to `normal_label`. With custom labels a tie therefore returned a label that is not one of the configured labels (`MajorityVote(normal_label=5, outlier_label=7).apply([AnomalyPrediction(label=5), AnomalyPrediction(label=7)])` gave `label=0`) or, with `normal_label=1, outlier_label=0`, the outlier. `tie_breaker` now defaults to `None`, which is resolved to `normal_label`; an explicit `tie_breaker` behaves as before and the default labels are unchanged. Tests: `test_tie_breaker_defaults_to_custom_normal_label` fails on master (`label=0 != label=5`) and passes with the change; `test_explicit_tie_breaker_with_custom_labels` pins the explicit case. `pytest apache_beam/ml/anomaly/aggregations_test.py`: 10 passed (1 failed on master); `pytest apache_beam/ml/anomaly`: 99 passed, 2 skipped. yapf and ruff are clean on the touched files. CHANGES.md updated. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
