Formation of the Structure and Training of a Multilayer Neural Network for the Analysis and Blood Glucose Level Prediction

The work aims to develop software for conducting research on the formation of the structure and training a multilayer neural network for analyzing and blood glucose level prediction. The paper analyzes the task, considers the tools, methods and algorithms for solving the problem. A model of an artificial neural network was investigated, the structure was developed and training was carried out. Summed up based on the results and assessed the effectiveness of such a system.


Introduction
The intensive development of medical science, the increase in data on markers of various pathological conditions dictates the need to search for new approaches to processing the results obtained. In this regard, more and more attention is paid to information technology.
One of the topical areas of biomedical research is the development and implementation of intelligent systems for the diagnosis and prediction of modern human diseases. Systems of this kind are based on various mathematical methods and algorithms.
Systems based on the mathematical apparatus of artificial neural networks are especially effective for solving problems of medical diagnostics and forecasting [1].
Research on artificial neural networks is associated with the fact that the way the human brain processes information is significantly different from the methods used by conventional digital computers. It can organize its structural components (neurons) so that they could perform specific tasks (such as pattern recognition) many times faster than existing computers [2].
The structure of neural networks copies the multilayer structure of certain parts of the brain. In a real biological neural network, an electrical signal is transmitted from inputs to outputs, which in the process of passing through the neural network, it can change. There are single-layer and multi-layer neural networks, on each of which the layers contain a certain number of neurons.
There are different ways to train a neural network: with a teacher, without a teacher, with reinforcement. There are also many methods of learning algorithms (conjugate gradient method, backpropagation method, Levenberg-Marquardt method, and others) [2].
One of the most important areas of medicine -endocrinology and diabetes mellitus is the most important problem. Diabetes mellitus is a metabolic disease caused by an absolute deficiency in insulin secretion and characterized by the body's inability to maintain blood glucose levels. The main way to solve this problem at present is the introduction of artificial insulins into the patient's blood.
With the current scale of the problem, physicians have intensively studied the processes in the human body that affect the level of glucose. It has been found that physical activity [3], stress [4], mental state, and above all nutrition, affect blood glucose levels. To simulate the impact of human activity, i.e. the influence of consumed carbohydrates entering the human blood on the level of glucose in the blood has been proposed a large number of mathematical models [5]. Typically, models with a large number of parameters can simulate human digestion process more accurately than models with a low lack of parameters, but they become increasingly difficult to adapt for application to a real outpatient patient with diabetes mellitus due to significant personal (natural) variations in model parameters.
The selection of the insulin dose is a difficult task that not all patients can cope with. To solve this problem, continuous glucose monitoring systems are used, which measure the blood glucose level every five minutes, which allows the doctor and the patient to choose the necessary program for the introduction of artificial insulin.
In endocrinology, it is known that the insulin administered to the patient begins to act no earlier than 20-30 minutes from the moment of administration, based on this, the triggered signal about the current critical level of glucose in the blood does not leave the patient sufficient time to correct the situation.
In this regard, various methods for predicting blood glucose levels are considered. One of the options assuming the effective use of modelling is the use of artificial neural networks.
Based on the above information, it was decided to conduct a study, within the framework of which it is possible to determine the best parameters of an artificial neural network in the developed systems for the analysis and prediction of blood glucose levels.
Thus, the purpose of the work is to develop software for conducting research on the formation of the structure and training a multilayer neural network for analyzing and blood glucose level prediction. In the work, analyze the task, consider the tools, methods and algorithms for solving the problem. Explore a model of an artificial neural network, develop and conduct training. Summarize the results and evaluate the effectiveness of such a system.

Analysis of the Initial Data
The initial data is a database file (Table 1) containing information obtained using a Bluetooth sensor, namely information about the time of measurement and blood glucose level. The same database file is loaded with information about the time of intake and the number of carbohydrates, the time of administration and the dose of insulin injection. The collected information database used in the project was obtained from a real patient with type I diabetes. It is the SQLite database. To work with this format, you should use the SQLite library connected as a NuGet package. This library is the official SQLite database engine.
To work with initial data, the developed application supports working with SQLite database files, namely, it executes requests to read data used in work. The received information is displayed in a table on the form, for viewing and correction by the user. Based on the results of working with the program, you can get analytical reports in the form of a graph comparing a part of the initial data with the obtained forecasting results. For such reports, export as an image must be implemented.

Model of an Artificial Neural Network
An artificial neural network model developed based on the processes occurring in the human brain was proposed by the neurophysiologist W. McCulloch and the mathematician W. Pitts [3]. The neuron is the main computing unit of the brain. The human nervous system consists of approximately 87 billion neurons, which are connected by about 1-1015 synapses. Figure 1 shows a biological neuron and its simplified mathematical model [6].
A neuron receives a signal from its dendrites and sends an impulse along an axon. The axon branches out at the end and connects via synapses to the dendrites of other neurons. In the mathematical model of neurons, the x0 signal is connected to the dendrites of another neuron. The link is multiplicative and is determined by the synaptic weight of the link. Synaptic weights control the influence of one neuron on another. Dendrites deliver signals to the body of the neuron, where they are added. If the final sum exceeds the threshold, the neuron fires and sends an impulse along the axon. Excitation of a neuron is modelled by the activation function f.
An artificial neural network is a system that can change its structure under the influence of external factors, during the training of which, the internal parameters of an artificial neural network are adjusted to the input data, which makes it possible to identify patterns in the data, solve the problems of forecasting, classification and clustering.
A neuron, or perceptron (Figure 1), is a computing unit that has one or more weighted input connections, which in some way combines inputs and an output connection. The nodes are then organized into layers to form a network [7][8][9]. Each neural network includes the first layer of neurons, called the input, it does not perform any transformations and calculations, its task in another is to receive and distribute input signals to the rest of the neurons.
Distinguish between single-layer and multi-layer structure of a neural network. The first represents a set of neurons, in which signals from the input layer are immediately sent to the output layer. The second, in addition to the output and input layers, has several other hidden intermediate layers. It is more reminiscent of the structure of a biological neural network. The number of these layers depends on the complexity of the neural network.
An example of a multilayer neural network (Figure 2), consisting of three parts: • Input layer. Responsible for accepting input from the external environment. For a more accurate calculation of the result, the input data is normalized within the values reproduced by the activation function.

Preparation of Initial Data
The selection of data for training the network and their processing is the most difficult stage in solving the problem. The training dataset must meet several criteria -representativeness and consistency.
The original data is converted to a form in which it can be fed to the network inputs. Each record is called a training pair or training vector. The training vector contains one value for each network input and one value depending on the type of training for each network output [2].
In the work, the initial data are presented in the form of a database table, from which preparation for training and training of the neural network should be performed. Data retrieval is performed using an SQL query, during which the information we need is transferred to the application table for preview and adjustment.

Experimental Research
In the developed system, there are different options for setting up neural network training, such as the learning algorithm -three options, bias neurons for the input and hidden layers, activation functions for the hidden and output layers -5 options each, the number of neurons in the hidden layer, the number of learning epochs, the maximum limit learning errors. The initial data contains about 28 thousand lines, which means that there are about 14 thousand lines for the training sample, 11 thousand lines for the control, and 3 thousand lines for the exam. The input layer contains three neurons -the content of the insulin dose, the carbohydrate content, the glucose concentration, the output layer contains one layer, the difference in the glucose concentration with the previous measurement.
Based on this, a research plan was drawn up. To identify the best parameters of the neural network, you need to go through all the options for the system settings. Three variants of the learning algorithm and five activation functions were used on the hidden and output layers. A total of 75 options, respectively 75 tests and a description of the network settings in the form of tables. For variants with a learning error of less than one per cent, we will display the exam result of this neural network.
Based on the test results, it was revealed that the elastic backpropagation method performed well in comparison with other methods. This is the only method that has managed to train a neural network with an error of less than one per cent. From a detailed analysis of the results of this method, it can be seen that the achievement of such a learning result was achieved using a linear activation function on the output layer. Separately, you can consider the results of a bunch of activation functions, on the output and hidden layers, linear and tangent, linear and sigmoidal, linear and linear in table 2.  The table shows that the best option for the structure of an artificial multilayer neural network will be the structure from test 51. Let's experiment with it to identify the very minimum learning error -less than 0.1%. (Figure 3). The complete setup of the resulting structure of the neural network for our task is reflected in table 3.

Conclusion
As a result of the work, a system was developed for researching the formation of the structure and training of a multilayer neural network for analyzing and blood glucose level prediction.
A review of tools for the implementation of the task was carried out and methods of solution were chosen. The theory of the creation of artificial neural networks and the initial data are considered, the types and algorithms for learning the neural network are investigated.
As a result of the work, a structure was formed that allows you to select the parameters from the point of view of ensuring the accuracy of the artificial neural network. Analysis of the developed neural network for predicting blood glucose levels showed that the prediction accuracy is 78% (Figures 4 and 5). However, the accuracy of predicting blood glucose levels during periods without carbohydrate intake is 93%, and during periods of carbohydrate intake is 56%. From this it follows that a new, individualized pattern of carbohydrate absorption is needed.
Further development, improvement and use of the system suggests the development of methods for creating individual models of food and insulin absorption.