About this question

Logistic Regression Loss Function

Medium · Linear Algebra & Machine Learning · Quant Trader interview question · logistic-regression, loss-function, machine-learning, binary-cross-entropy

You are training a logistic regression model to predict whether a stock will go up (1) or down (0) tomorrow. You have a dataset of $n$ historical trading days. For each day $i$, you have the true outcome $y_i$ (either 0 or 1) and your model's predicted probability $\hat{p}_i$ that the stock will go up. Which of the following formulas represents the binary cross-entropy loss function (also known as the log loss) that you should use to train your model?