# Using Convolutional Neural Networks for Blocking Prediction in Elastic Optical Networks
## 4 CNN Structure
Under comparable circumstances (same design, network, and hyperparameters), a 1D CNN requires considerably lower computational power than a 2D CNN. Deep 2D CNN training typically requires specialized hardware (e.g., GPU farms or cloud computing). On the other hand, training compact 1D CNNs with few hidden layers and neurons is achievable over a conventional computer rather quickly. However, in this work, the 1D CNN,  
Figure 8: Proposed 1D CNN architecture for the network state classification between leading and not-leading-to-blocking. Figure 9: Proposed 2D CNN architecture for the network state classification between leading and not-leading-to-blocking. which can perform the required task, should have a relatively larger number of neurons and layers than the 2D CNN. Therefore, the difference in the required computational power for the training process is not much different. In this research, the proposed CNNs, a Support Vector Machine (SVM), and K Nearest Neighbor (KNN) are explored for the prediction of blocking events. These algorithms are well known for pattern detection and extraction. Based on our experience in tuning neural networks in this research, the type of filter is a critical parameter in the performance of blocking classification. Five types of filters with 700, 120, 50, 20, and 5 spectral snapshots covering each filter are used in the formation of the CNN model. In the initial layer, eight filters with the size of 700 samples are used. Snapshot features are learned in different layers with various patterns. In this paper, we provide an architecture to minimize the error between the labeled blocking and unblocking patterns and the output prediction layer. Binary categorical cross-entropy [25] is used as the objective loss function to estimate the difference between actual and predicted label values of the patterns. Adaptive moment estimation (Adam [26]), a type of Minibatch stochastic gradient descent algorithm, is employed as an optimization algorithm to update the network weights to minimize the output of the objective function [1]. In order to optimize the architecture of the suggested model, many hyperparameters need to be tested. To do this, many factors, including the CNN network's learning rate and the number of layers, are assessed via sensitivity try-and-error analysis. The models are trained in a system with an Intel i9 processor, 16 GB RAM, and graphic cards NVidia GeForce RTX 2080 Ti using GPU for parallel computing. However, different Python libraries, such as Keras [26], scikit-learn, etc., are used to implement each task presented in the methodology. During the training process of the models, we also investigate the effect of the number of epochs on the learning, to make sure the models are trained appropriately and adequately. Figure 10 shows an example of the effect of the number of training attempts (epochs) on the prediction accuracy and on the training and validation dataset. We observe that after a certain number of epochs (around 200 epochs), the model performs better on the training set; however, we do not observe a significant improvement in the performance of the model on the validation dataset. We can conclude that the improvement after about 200 epochs is insignificant, indicating that the number of epochs is sufficient, and increasing the number of epochs beyond that might cause an overfitting issue.