Complete the code to import the TensorFlow library.
import [1] as tf
TensorFlow is imported using the name 'tensorflow' to use its functions with the alias 'tf'.
Complete the code to create a Sequential model for text classification.
model = tf.keras.models.[1]()The Sequential class is used to build a simple linear stack of layers for the model.
Fix the error in the code to add an Embedding layer with input dimension 10000 and output dimension 16.
model.add(tf.keras.layers.Embedding([1], 16))
The input dimension should match the vocabulary size, which is 10000 here.
Fill both blanks to compile the model with Adam optimizer and sparse categorical crossentropy loss.
model.compile(optimizer='[1]', loss='[2]', metrics=['accuracy'])
Adam is a popular optimizer and sparse categorical crossentropy is used for integer labels in classification.
Fill all three blanks to train the model for 10 epochs with training data and validation data.
history = model.fit([1], [2], epochs=[3], validation_data=val_data)
Model.fit requires training inputs, training labels, and number of epochs to train.
