mirror of
https://github.com/ROCm/jax.git
synced 2025-04-19 05:16:06 +00:00
Merge pull request #338 from gdahia/fix-readme-toy-example
Change implementation of negative log-likelihood in README toy example
This commit is contained in:
commit
0ca0968533
@ -243,8 +243,8 @@ def logistic_predictions(weights, inputs):
|
||||
# Training loss is the negative log-likelihood of the training labels.
|
||||
def loss(weights, inputs, targets):
|
||||
preds = logistic_predictions(weights, inputs)
|
||||
label_probs = preds * targets + (1 - preds) * (1 - targets)
|
||||
return -np.sum(np.log(label_probs))
|
||||
label_logprobs = np.log(preds) * targets + np.log(1 - preds) * (1 - targets)
|
||||
return -np.sum(label_probs)
|
||||
|
||||
# Build a toy dataset.
|
||||
inputs = np.array([[0.52, 1.12, 0.77],
|
||||
|
Loading…
x
Reference in New Issue
Block a user