Algebraic reconfiguration of LSTM network for automated video data stream analytics using applied machine learning

. Recurrent neural networks (RNNs) are a powerful tool for processing sequential data. However, the standard LSTM architecture, despite its effectiveness in capturing long-range dependencies, can still encounter some problems when dealing with particularly complex sequences. In this paper, we present a mathematical modification of LSTM that extends the basic advantages of the long short-term memory model and will help to model complex dependencies in data more accurately.


Introduction
This publication presents a new research work that aims to improve the progressive Recurrent Neural Network (RNN) architectures, namely the Long Short Term Memory (LSTM) network.
LSTM has earned a high application ranking in sequence processing tasks [1], becoming an integral component of machine learning in the field of sequential data analysis.The main reason for this performance has largely been its unique ability to process big data over long time intervals.However, despite the superiority of LSTM over traditional RNNs, the original LSTM architecture still has drawbacks when solving problems of different subject areas (most often the problems are caused by the presence of complex dependencies in the original data sets) [2].
In this study, the authors propose the use of a new innovative approach for the mathematical modification of the LSTM.The method is based on the introduction of an additional filtering valve, its further integration into the state update and the application of the  activation function.The mathematical modification is designed to address some of the limitations of the standard LSTM and provide the model with an increased ability to analyze complex long-term dependencies in multivariate sequential data.
Based on fundamental theoretical calculations and empirical experiments, the authors of this paper report that the proposed mathematical modification of the LSTM significantly outperforms its baseline configuration in a number of key metrics, such as:  accuracy of predictions;  "memory" efficiency (improving the quality of the main indicator of this type of models -since LSTM should remember the context for a long time, and which one -the network determines independently);  learning speed (acceleration of convergence of the formation of the final generalisability function on the training data sample);  resistance to overfitting.
It is important to emphasise that the improvement of LSTM by means of a new modification is one of the first steps towards the creation of more efficient and adaptive algorithms for processing sequential data, which have the potential to significantly improve the quality and reliability of results in a variety of applications, including applications in artificial intelligence, natural language processing and time series analysis [3].
This research paper presents a unique contribution to the development of recurrent neural networks and their applications in a wide range of applications.The study analyses in detail the presented modifications, their mathematical foundations and computational performance, which makes the work fundamental for future research in the field of deep learning model architectures [4].

Results and discussion
The construction of the Long Short-Term Memory (LSTM) neural network model allowed scientists to levelling many disadvantages of classical variations of recurrent neural networks [5].The standard configuration of the LSTM architecture is presented in Figure 1.However, the LSTM model architecture can be even more effective in solving application problems if some modifications to the underlying mathematical model are undertaken: 1. Adding an additional input gate   .
To strengthen the control over the information flow between the hidden state at the current time step  and the next state ℎ +1 , it is proposed to add an additional input gate   .This gate determines which information from the current state ℎ  will be passed to the next step.
In such a variation, the formula for the input gate takes the following form: Where   is the weight matrix for the input gate,   is the offset,  is the sigmoidal activation function.
2. Integration of input gate (filtering gate) into the state update   .
To take into account the influence of the filtering gate   on the state update   , we make the following changes to the state update formula: Where   is the forget gate,   is the input gate,  ̃ is the candidate state, ℎ  is the hidden state of the LSTM at the current time step , and ⊙ denotes the piecewise multiplication.
The standard LSTM architecture uses the activation function ℎ to compute the candidate state  ̃ and the hidden state ℎ  .In our modification, we propose to replace ℎ with a  activation function to increase the nonlinearity and the ability of the model to handle a variety of data types.
In this case, the modified formula for the candidate state based on  will have the following form: The formula for the hidden state with  activation function will also be subject to adjustment: To implement a mathematical modification of the LSTM with the addition of an additional filtering fan, integration into the state update and the use of the  activation function, we will use the PyTorch library.PyTorch provides ready-made basic methods written in low-level programming languages for building and training neural networks (including the special case of the LSTM model) [6].
An example of implementation of the LSTM model modification is shown in Figures 2-3.It should be noted that in the considered example a modified class  has been implemented, which inherits basic methods necessary for building efficient neural network architectures from the . class.
Within the class, all LSTM parameters and gates are defined, and a new (additional) filtering gate is added.When running the software example, it can be observed that the new filtering valve helps the model to preserve and adapt the information inside the hidden state.It should also be noted that the use of the  activation feature achieves greater nonlinearity and the ability of the model to handle a variety of data [7,8].
In order to more thoroughly test the performance of the modified LSTM, it is recommended to further use more complex and diverse datasets, and to tune the hyperparameters of the model using cross-validation [5].

Conclusion
The mathematical modification to the LSTM presented in this paper includes the addition of an additional filtering valve and the replacement of the ℎ activation function with .These modifications improve LSTM's ability to model complex dependencies in the data and better handle particularly complex sequences.However, it is important to remember that when developing new LSTM architectures, model parameters must be thoroughly tested and tuned to achieve optimal results on the differing subject areas of the dataset [8].

Fig. 1 .
Fig. 1.Standard architecture of the LSTM neural network model

Fig. 2 .Fig. 3 .
Fig. 2. Listing of the software implementation of the modified LSTM model