python
python copied to clipboard
Increased Robustness: Prevent crashes if dataset contains only identical elements
In this case, (for example a degenerated probability distribution of 0 for all datapoints) the "abm" variant crashes during predict, because the logistic regression is called with the wrong amount of parameters
https://github.com/betacal/python/blob/3a9dbb4bfa8b81ff1adbb979e1d6d4dbd8106ddc/betacal/beta_calibration.py#L115-L120
This happens because the logistic regressions coefficients get 0 for such a degenerated case, and the lines above are executed accidentally. De-aliasing the accidental 0 case with a None variable solves that issue.