import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv1D, MaxPooling1D, Flatten, Dense, Dropout
# Set random seeds for reproducibility
np.random.seed(42)
tf.random.set_seed(42)
# Model parameters
input_length = 101
num_classes = 2 # Binary classification: TFBS (1) or not TFBS (0)
# Create a Keras neural network model
model = Sequential()
model.add(Conv1D(filters=32, kernel_size=12, activation='relu', input_shape=(input_length, 4)))
model.add(MaxPooling1D(pool_size=4))
model.add(Flatten())
model.add(Dense(32, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(num_classes, activation='softmax'))
# Compile the model
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
# Train the model
X_train = np.array(X_train) # Replace with your training data
y_train = np.array(y_train) # Replace with your training labels
history = model.fit(X_train, y_train, batch_size=32, epochs=10, validation_split=0.2)
# Evaluate the model
X_test = np.array(X_test) # Replace with your testing data
y_test = np.array(y_test) # Replace with your testing labels
_, accuracy = model.evaluate(X_test, y_test)
print(f'Test accuracy: {accuracy * 100:.2f}%')
Replace the X_train, y_train, X_test, and y_test with your actual data. This code defines a simple CNN model with one convolutional layer, a max-pooling layer, and two dense layers with dropout for regularization. You can adjust the hyperparameters and the model architecture as needed.