Login using Social Account
     Continue with GoogleLogin using your credentials
Note:
datasets["train"]
contains the train data. Similarly, datasets["test"]
contains the test data.
datasets["train"].batch(2)
batches 2 data samples at a time.
datasets["train"].batch(2).take(1)
allows to take 1 batch at a time.
Each batch is of type Eager Temsor
. We could convert it to numpy array using X_batch.numpy()
.
We shall traverse through the batches and show the review(first 200 characters) and label of the first batch data samples:
for X_batch, y_batch in datasets["train"].batch(2).take(1):
for review, label in zip(X_batch.numpy(), y_batch.numpy()):
print("Review:", review.decode("utf-8")[:200], "...")
print("Label:", label, "= Positive" if label else "= Negative")
print()
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...