# Predictive Modeling of Light-Matter Interaction in One Dimension: A Dynamic Deep Learning Approach
## 2 Methods
### Segmentation of a Given Input/Output Dataset for Neural Network Training  
In order to evaluate the weights of the three-layer neural network adaptively using many narrow time intervals, one has to divide a given signal into many small segments, each containing M samples that can be used to train the neural network for identifying the local behavior of the underlying system. Each segment should be small compared to the size of the entire signal so that both the linearity and the slowly time-varying system approximation can be made. By computing the coefficients of a 3-layer network at each and every segment and then combining them, one can determine the temporal evolution of the coefficients (thus the network) through the duration of the entire signal, thereby performing dynamic deep learning that facilitates a self-learning network for precise prediction of future output values even under very limited input data. The segmentation can be performed in different ways, as stated below. * Use a segment window of M samples and a segment period of N (N = M) samples: Under this segmentation, all segments are adjacent to each other and there is no overlap between them. If the entire signal \(S\) is divided into \(P\) segments, this is stated as follows: \[ \begin{split} S(n;1)=[s_{1},s_{2},\dots,s_{M}],& S(n;2)=[s_{M+1},s_{M+2},\dots,s_{2M}],\dots,S(n;P)=\\ &\left[s_{M\times(P-1)+1},s_{M\times(P-1)+2},\dots,s_{M\times P} \right]\end{split} \] (23)
* Use a segment window of M samples and a segment period of N (N \(\
eq\) M) samples: For this case, the segments may or may not be overlapping depending on N and M: \[ \begin{split} S(n;1)=[s_{1},s_{2},\dots,s_{M}],& S(n;2)=[s_{N+1},s_{N+2}, \dots,s_{N+M}],\dots,S(n;P)=\\ &\left[s_{N\times(P-1)+1},s_{N\times(P-1)+2},\dots,s_{N\times(P-1 )+M}\right]\end{split} \] (24)  
If N < M, the overlap ratio is \(\left(\text{M}-\text{N}\right)/\text{M}\). Whereas if N > M, then the overlap ratio is zero. However, if N is much larger than M, then many samples remain idle, which leads to an inefficient use of data. Hence, if no overlap is desired, one should choose N = M.
* Use a segment window of M samples and a segment period of N (N \(\ll\) M) samples: Here, the overlap ratio is \(\left(\text{M}-\text{N}\right)/\text{M}\approx 1\). This means that each subsequent segment is nearly identical to its neighbor but not completely the same. This is an efficient use of data in cases where the underlying system is strongly time-variant. Whereas if the system is weakly time-variant, this can cause the unnecessary creation of new segments, which would bring little new information about the system (a slow update of the neural network weights would be sufficient) at the cost of drastically increased computation time. * Use a segment window of M samples and a segment period of N = 1 sample: In this scenario, each consecutive segment differs only through a single sample shift. This means that subsequent segments totally overlap with each other, except for a single sample such that \[ \begin{split} S(n;i)=\left[s_{M\times(i-1)},s_{M\times(i-1)+1}, \dots,s_{M\times i-1}\right],& S(n;i+1)=\left[s_{M\times(i-1)+1}, s_{M\times(i-1)+2},\dots,s_{(M\times i)}\right]\\ & i=1,2,\dots P\qquad(i:Segment\ number)\end{split} \] (25) This form of segmentation (Figure 2) enables a very efficient use of data under fast time-variation of the system coefficients. Despite our assumption of a slowly time-varying system, we will make use of this segmentation for a sample-by-sample computation of the neural network coefficients in order to see their temporal evolution in full resolution. Under such sample-by-sample segmentation, to predict the upcoming samples of the output vector y, one has to solve for the set of coefficients at each layer and for each estimated sample. This means that to predict N future samples, the coefficient vectors \(w_{1},w_{2},w_{3}\) must be solved based on Equation (22), which can be expanded as three consecutive matrix multiplications:  
\[ \begin{bmatrix}y(M+1)\\ \cdot\\ y(M+N)\end{bmatrix} =