Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/source/keras_integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class MetricsCallback(keras.callbacks.Callback):

def on_epoch_end(self, epoch, logs=dict()):
m = self.model
# Ensure we get labels of "1" or "0"
training_preds = np.round(m.predict(self.x_data))
# Accuracy expects one integer label per example.
training_preds = np.round(m.predict(self.x_data)).reshape(-1).astype(np.int32)
training_labels = self.y_data

# Compute score and save
Expand Down Expand Up @@ -102,8 +102,8 @@ We can also use the same metric after model training! Here, we show how to check

```python
acc = evaluate.load("accuracy")
# Round the predictions to turn them into "0" or "1" labels
test_preds = np.round(model.predict(x_test))
# Convert the sigmoid outputs from shape (num_examples, 1) into integer labels.
test_preds = np.round(model.predict(x_test)).reshape(-1).astype(np.int32)
test_labels = y_test
```

Expand Down