LSTM Base Model

lstm_base_model.build_base_model(X_train, y_train, X_test, y_test, class_weight_dict)

LSTM Base Model for classification of network use case scenarios.

This script loads preprocessed training and testing data, defines and trains a baseline LSTM model, evaluates its performance, and saves the final model in HDF5 and Keras formats. Class balancing is handled using precomputed class weights.

Usage
  • This script is designed to be executed as a module. Use the function build_base_model() to construct and optionally train the model.

Args
  • X_train (numpy.ndarray): Preprocessed training data.

  • y_train (numpy.ndarray): Labels for the training data.

  • X_test (numpy.ndarray): Preprocessed testing data.

  • y_test (numpy.ndarray): Labels for the testing data.

  • class_weight_dict (dict): Class weights for handling class imbalance.

Returns
  • model (tensorflow.keras.Model): Trained LSTM model.