## 3 AI/ML Algorithm
They have LSTM cell numbers of 30, 20, and 10, respectively. They are followed by another three fully connected (FC) dense layers with neural numbers of 32, 16, and 2, respectively. The dropout layer is used before the last layer to prevent overfitting. The activation functions for the first five layers are Relu, and the last layer is Softmax. The loss function is sparse categorical cross-entropy (SCCE) and the optimizer is Adam. The learning rate, epoch, and batch size are 0.01, 200, and 30, respectively. Figure 5: Image turned counterclockwise 90 degrees and the columns added up (indicated by the red arrows). Figure 6: Obtaining the average column vector and locating the two headers from the average column vector. Figure 7b shows the LSTM cell [49] used in decoding the UWOCC system. Variables in the LSTM cell include \(x_{t}\), \(C_{t-1}\), \(C_{t}\), \(h_{t-1}\), \(h_{t}\), and \(y_{t}\). They are the current input, cell state memory from the last cell, cell state memory from the newly updated cell, hidden state output of the last cell, hidden state output of the current cell, and current output, respectively. \(\sigma\) is the sigmoid activation. There are three gates in each LSTM cell. They are the forget gate, input gate, and output gate. The forget gate can decide whether the information should be stored or erased, the input gate determines what new information is stored, and the output gate produces output based on the LSTM cell state after different operations. First, we discuss the forget gate operation as shown in Equation (1). \[f_{t}=\sigma(W_{f}[x_{t},h_{t-1}]+b_{f}) \tag{1}\]  
where \(W\) and \(b\) are the weight and base, respectively. The result in Equation (1) will be multiplied by the old LSTM cell state \(C_{t-1}\) and added with the results from the input gate to produce the new LSTM cell state \(C_{t}\), as illustrated in Equation (2). \[C_{t}=f_{t}\times C_{t-1}+i_{t}\times g_{t} \tag{2}\]  
Then, we discuss the input gate. Equation (2) shows the product of the two outputs from input gate \(i_{t}\times g_{t}\), and they can be expressed in Equation (3). \[ \begin{split} i_{t}=\sigma(W_{i}[x_{t},h_{t-1}]+b_{i})\\ g_{t}=\tanh(W_{g}[x_{t},h_{t-1}]+b_{g})\end{split}  \tag{3}\]  
Finally, the result from the output gate can be expressed in Equation (4). \[o_{t}=\sigma(W_{o}[x_{t},h_{t-1}]+b_{o}) \tag{4}\]  
Then, the updated hidden cell state obtained in Equation (4) can be multiplied with the \(\tanh\) function of the previous LSTM cell state, as illustrated in Equation (5). \[y_{t}=h_{t}=o_{t}\times\tanh(C_{t-1}) \tag{5}\]  
In the LSTM-NN, several time domain features should be extracted for training. In the experiment, the input OCC signal is divided into several groups, and the number of each group is the \"PPB\". The parameter for time is \"time-step\", which is equal to 4. This means that when time is equal to \(t\), the signal from \(t-4\) to \(t-1\) will be considered, as illustrated in Figure 8.  
Figure 7: (**a**) Architecture of the proposed LSTM-NN. (**b**) Architecture of the LSTM cell in the LSTM layer. Finally, BER measurement of the RS-based UWOC system with PMMA SGOF is performed. Here, in this proof-of-concept experiment, the LSTM-NN will be compared with the PPB-NN [40]. Additionally, the experiment of the UWOC system without water is also performed for comparison. Figure 9 shows the architecture of the PPB-NN used for the comparison. It consists of one input layer, two hidden layers, and one output layer. The activation functions are Relu and Softmax, respectively, as shown in Figure 9. It is similar to a typical fully connected deep neural network (DNN) but with a different input layer. Here, the PPB-NN input layer should match the pixel per bit in the experiment. If the pixel per bit is not a round number, it should be rounded off to the higher round number. For example, if the PPB is 4.1, it will be rounded off to 5; then, the number of neurons in the input layer is 5. Figure 8: Illustration of the LSTM-NN mechanism for the time step of four.