| | Algorithm: FCNN training algorithm of raw traffic intrusion detection model based on Gabor network |
| Input: custom_gabor, custom_gabor2 # gabor filter |
| X_train # training set |
| Y_train # training label |
| X_val # validation set |
| Y_val # verify tag |
| epochs = loop_num # iterations |
| batch_size = 10 # batch size |
| path = “model/fcnn” # training model save path |
| Output: model FCNN |
| (1) | FCNN = Sequential () |
| (2) | FCNN.add (Convolution1D (48, 3, trainable = False, |
| kernel_initializer = custom_gabor, |
| border_mode = “same”, |
| activation = “relu”, |
| input_shape = (featureNum, 1))) |
| (3) | FCNN.add (Convolution1D (48, 3, border_mode = “same”, activation = “relu”)) |
| (4) | FCNN.add (MaxPooling1D (pool_length = (2))) |
| (5) | FCNN.add (Convolution1D (128, 3, trainable = False, |
| kernel_initializer = custom_gabor2, |
| border_mode = “same”, |
| activation = “relu”)) |
| (6) | FCNN.add (Convolution1D (128, 3, border_mode = “same”, activation = “relu”)) |
| (7) | FCNN.add (MaxPooling1D (pool_length = (2))) |
| (8) | FCNN.add (Flatten ()) |
| (9) | FCNN.add (Dense (128, activation = “relu”)) |
| (10) | FCNN.add (Dropout (0.1)) |
| (11) | FCNN.add (Dense (1, activation = “sigmoid”)) # the construction process of FCNN model |
| (12) | FCNN.compile (loss = “binary_crossentropy”, optimizer = “Adam”, metrics = [“accuracy”]) |
| (13) | FCNN.fit (X_train, y_train, |
| validation_data = (X_val, y_val), |
| batch_size = 10, |
| epochs = loop_num) # training FCNN |
| (14) | FCNN.save (path + “FCNN_model.hdf5”) # Save the model |