Calculate the binary cross-entropy loss for binary classification predictions.
Binary cross-entropy measures how far a predicted probability is from the true binary label: BCE = −(y·ln(p) + (1−y)·ln(1−p)). When y = 1, only the first term is active and loss grows as p moves away from 1; when y = 0, only the second term is active and loss grows as p moves away from 0. This is the standard loss function for binary classifiers with a sigmoid output, and it penalizes confident wrong predictions far more heavily than a squared-error loss would, since ln(p) → −∞ as p → 0.
BCE = -(y × ln(p) + (1 - y) × ln(1 - p))
Natural log (ln) is the conventional choice in most deep learning frameworks because it simplifies the gradient during backpropagation through the sigmoid function; log base 2 would just scale the loss by a constant factor (1/ln(2)) without changing which model is 'better.'
The loss becomes infinite in theory (ln(0) is undefined/−∞), which is why in practice predicted probabilities are clamped to a small epsilon away from exactly 0 or 1 before computing the loss, as this calculator does internally.
They are the same formula — 'log loss' is simply the more general/statistical name for binary cross-entropy loss applied to a single sample; averaging BCE over many samples gives the dataset-level log loss reported by tools like scikit-learn.