Import As Import As Import As From Import From Import From Import From Import From Import
Import As Import As Import As From Import From Import From Import From Import From Import
max_words = 10000
max_sequence_length = 500
model = Sequential()
model.add(GlobalMaxPooling1D())
model.add(Dense(256, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))
batch_size = 64
epochs = 10
history = model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs, validation_data=(x_test,
y_test))
# Generate predictions
y_pred_probs = model.predict(x_test)
plt.figure(figsize=(10, 5))
plt.xlabel('Samples')
plt.ylabel('Sentiment')
plt.legend()
plt.show()
cm = confusion_matrix(y_test, y_pred)
plt.figure(figsize=(8, 6))
plt.title('Confusion Matrix')
plt.xlabel('Predicted Label')
plt.ylabel('True Label')
plt.show()