def training_loss(weights):
    # Training loss is the negative log-likelihood of the training labels.
    preds = logistic_predictions(weights, inputs)
    label_probabilities = preds * targets + (1 - preds) * (targets - 1)
    return -np.sum(np.log(label_probabilities))

# Build a toy dataset.
dataset/ETHPy150Open HIPS/autograd/examples/logistic_regression.py/training_loss/swapped operands of `-`