Complete the code to create a multi-class classification model using TensorFlow Keras.
model = tf.keras.Sequential([
tf.keras.layers.Dense(64, activation='relu', input_shape=(input_shape,)),
tf.keras.layers.Dense(10, activation=[1])
])For multi-class classification, the output layer uses the softmax activation to output probabilities for each class.
Complete the code to compile the multi-class classification model with the correct loss function.
model.compile(optimizer='adam', loss=[1], metrics=['accuracy'])
For multi-class classification with one-hot encoded labels, categorical_crossentropy is the correct loss function.
Fix the error in the code to correctly prepare labels for multi-class classification training.
y_train_encoded = tf.keras.utils.to_categorical([1], num_classes=10)
Labels for training (y_train) must be converted to one-hot encoding for multi-class classification.
Fill both blanks to train the model with the encoded labels and set the number of epochs.
history = model.fit(X_train, [1], epochs=[2], batch_size=32, validation_split=0.2)
Use the encoded training labels y_train_encoded and set epochs to 10 for training.
Fill all three blanks to evaluate the model on test data and print the accuracy.
loss, accuracy = model.evaluate([1], [2], batch_size=32) print(f"Test accuracy: [3]")
Evaluate the model on test features X_test and encoded test labels y_test_encoded, then print the accuracy.