Merge pull request #346 from gdahia/fix-readme-toy-example

Fix README toy example incomplete `label_probs` var renaming
This commit is contained in:
Matthew Johnson 2019-02-08 14:20:17 -08:00 committed by GitHub
commit 42b3218e90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -244,7 +244,7 @@ def logistic_predictions(weights, inputs):
def loss(weights, inputs, targets):
preds = logistic_predictions(weights, inputs)
label_logprobs = np.log(preds) * targets + np.log(1 - preds) * (1 - targets)
return -np.sum(label_probs)
return -np.sum(label_logprobs)
# Build a toy dataset.
inputs = np.array([[0.52, 1.12, 0.77],