## 4 Training  
By using a mathematical model that generates real-time input data at each training phase, the accumulation of a collection of training and test data in computer memory can be avoided. Furthermore, this method eliminates the need to label training and test datasets. Parameters from the ranges listed in Table 2 were used to create a model of the input data. The algorithm that underpins the neural network training process includes the series of steps below:  
1. Modeling of the FBG reflection spectrum at a wavelength arbitrarily selected from the range [\(\lambda_{\text{B}}-0.5\) nm; \(\lambda_{\text{B}}+0.5\) nm], where \(\lambda_{\text{B}}\) is the central value of the wavelength within the controlled wavelength interval \(\Delta\). The resulting spectrum \(\{R_{i}\}\) is discretized at \(\Delta\lambda\) intervals. The amplitude values \(\{R_{i}\}\) and the central wavelength \(\lambda_{\text{B}}\) are normalized by (1). 2. Setting the initial values of synaptic weights and shifts: \[w_{k,j}^{n}=\frac{1}{2}-\text{rnd}(1),\;\;b_{k}^{n}=\frac{1}{2}-\text{rnd}(1 )\;.\] (4) \begin{table}
\begin{tabular}{l c c} \hline \hline
**Parameters** & **Values** & **Normalized Values** \\ \hline FBG length (\(L\)) & 0.5 \(\div\) 3.5 mm & - \\ Refractive index (\(n\)) & 1.4586604 & - \\ Induced refractive index (\(\Delta n\)) & 0.5\(\cdot 10^{-4}\div 1.5\cdot 10^{-4}\) & - \\ Controlled wavelength interval (\(\Delta\)) & 1548.5 \(\div\) 1551.5 nm & 0 \(\div\) 1 \\ Central wavelength (\(\lambda_{\text{B}}\)) & 1549.5 \(\div\) 1550.5 nm & 0.333 \(\div\) 0.667 \\ Discretization interval (\(\Delta\lambda\)) & 0.16667 nm & 1/18 \\ Full width at half height & 0.229 \(\div\) 1.458 nm & 0.076 \(\div\) 0.486 \\ Maximum amplitude & 0.61 \(\times\) 216 a.u. & 1 \\ Amplitude variation range & 3.92\(\cdot 10^{-4}\times 216\div 0.15\times 216\) a.u. & 6.42\(\cdot 10^{-4}\div\) 0.26 \\ Noise & 0 \(\div\) 2 \(\times\) 10\({}^{-3}\times 216\) a.u. & 0 \(\div\) 0.002 \\ Pedestal & 0 \(\div\) 2 \(\times\) 10\({}^{-1}\times 216\) a.u. & 0 \(\div\) 0.2 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: FBG reflection spectrum modeling parameters. Direct signal propagation through a neural network, consisting of these steps:  
Calculating the weighted sum of the sensory layer neurons' values;  
Calculating the associative layer values (using a nonlinear activation function);  
Calculating the weighted sum of the associative layer's neurons' values;  
Calculating the value of the neurons in the response layer (using a linear activation function) for each neuron in the associative and reacting layers. Direct propagation yielding a normalized FBG central wavelength value representing neural network responses. Reverse propagation of the error signal, consisting of these steps:  
Calculating the error of the FBG central wavelength determination (the norm between the target value vector and the neural network response vector) according to the selected metric;  
Calculating the error for each neural network parameter in sequence using the Adam optimization algorithm;  
Correcting synaptic weights and model shifts. Verifying that the training algorithm criterion meets the requirement:  
\[\left|\frac{1}{I}\sum_{i=K-I}^{K-1}\mathrm{d}\left(\lambda_{B}^{i},\overline{ \lambda}^{i}\right)-\frac{1}{I}\sum_{j=K-2I}^{K-I-1}\mathrm{d}\left(\lambda_{B }^{j},\overline{\lambda}^{j}\right)\right|<\varepsilon_{1}, \tag{5}\]  
where \(\lambda_{B}^{i(j)}\) and \(\overline{\lambda}^{i(j)}\) are the target and calculated values of the FBG central wavelength at the \(i(j)\)th iteration, \(I\) is the number of iterations for which averaging occurs, \(K\) is the number of training iterations, and \(\varepsilon_{1}\) is an arbitrary predetermined small value. The neural network training that had occurred before the criterion met the requirement (5) amounted to a little more than \(10^{6}\) training algorithm iteration cycles.