Training the Stochastic Kinetic Model of Neuron for Calculation of an Object’s Position in Space

In this paper we focus on the stochastic kinetic extension of the well-known Hodgkin-Huxley model of a biological neuron. We show the gradient descent algorithm for training of the neuron model. In comparison with training of the Hodgkin-Huxley model we use only three weights instead of nine. We show that the trained stochastic kinetic model gives equally good results as the trained Hodgkin-Huxley model, while we gain on more concise mathematical description of the training procedure. The trained stochastic kinetic model of neuron is tested in solving the problem of approximation, where for the approximated function the membrane potential obtained using different models of a biological neuron was chosen. Additionally, we present a simple application, in which the trained models of neuron connected with the outputs of a recurrent neural network form a system, which is used to calculate the Euler angles of an object’s position in space, based on linear and angular acceleration, direction and the magnitude of Earth’s magnetic field.


Introduction
Neuron models which precisely describe the processes that take place on the membrane (in particular the Hodgkin-Huxley model and its kinetic extensions) can be expressed in the form commonly used for artificial neural networks.The biological neuron model consists of a current input and a voltage output which is coupled with the input; there are also parameters that can be treated as weights [5][6][7] and sigmoid functions that determine the activation functions.
In the Hodgkin-Huxley model considered in [5][6][7] nine parameters are used as weights.In this paper we show that if the stochastic kinetic model is used, it is possible to obtain equally good results of training and gain on less complex mathematical description of the training procedure, due to reducing the number of weights to three and replacing most of differential equations with 'add-and-multiply' rules.The gradient descent algorithm is used in the training procedure.Researchers use models of a biological neuron in a number of applications, very often in the field of automatics and robotics.Usually these models exhibit only the spiking nature of a neural cell, without taking into account all of the ionic processes that take place in the neuron.Such spiking neuron models are applied in: -robot control (cf.[1], where a neural network built with Izhikevich neuron models was tested on a model of an arm of a humanoid robot iCub), -a neural PID controller, where a neuron model is expected to adjust parameters of the controller or to approximate differential and integral equations [28], -creation of a visual attention map [29], -general path planning [13,21,30].
The neuron model commonly used in the above applications is the Izhikevich model, presented among others in [14].This model is described with only two equations: where v is the potential on the neuron's membrane, u is the membrane recovery variable and I is the input current (stimulus), while a and b represent the time scale and sensitivity of the recovery variable, respectively.In our paper, however, we will consider the stochastic kinetic model of biological neuron, which besides the spiking nature of neuron, takes into account ionic processes that take place on the membrane.
In this paper we present the gradient descent algorithm for training the stochastic kinetic model of neuron.The trained model is used to control the process of calculating the Euler angles of an object in space (Roll, Pitch, Yaw) based on data collected from three sensors: accelerometer, gyroscope and magnetometer.These sensors are part of the Attitude and Reference Heading System (AHRS) and are created in Micro Electro-Mechanical Systems (MEMS) technology.The AHRS enables calculation of the Euler angles, but the AHRS algorithm is computationally expensive in view of matrix calculations, hence the idea of using an artificial neural network combined with a model of a biological neuron, which is less complex than commonly used algorithms.
The same algorithm of gradient descent was already used for the training of a model of a dendritic structure of the biological neuron given with the following equation [12]: This means adopting the algorithm of gradient descent in the structure that can be treated as a biological neural network (not just a single neuron).The way of discretization and implementation of this kind of dendritic structure of biological network is presented in [26].The procedure of the training of the stochastic kinetic model of a biological neural network and application of the trained model in an image processing task are shown in [23].
The main objective of the research presented in this paper is focused on determining an object's position in space.Our research also includes self-testing of robot's sensors [15].We are still expanding these calculations with new ideas.Models of biological neuron and biological neural networks are of our interest.We are trying to apply them to solve our problems and to analyse their capabilities, hence the presented research.
The paper is organized as follows: in Section 2 shows the Hodgkin-Huxley model and its extension to the deterministic and stochastic kinetic model.Section 3 presents the gradient descent algorithm for training of the stochastic kinetic model.Section 4 focuses on experimental results, while Section 5 shows applications of a trained model of the biological neuron.Finally, in Section 6, a short summary is provided.

Model of the Biological Neuron
In this section we will provide a short description of the Hodgkin-Huxley neuron model and its deterministic and stochastic kinetic extensions.

The Hodgkin-Huxley Model of the Biological Neuron
The neuron model created by Alan Lloyd Hodgkin and Andrew Huxley in 1952 is based on the idea that the potential on the membrane can be modeled with an equivalent circuit and described with the following equation [2,9,12,16,17]: where I is the total membrane current density (input of the neuron), V is the potential (output of the neuron), C is conductance, while g Na , g K and g L are conductivities and V Na , V K , V L are the reverse potentials of specific types of ionssodium, potassium and chloride, respectively.Values of the conductivities and reverse potentials are shown in Table 1.
The membrane is built from channels which consist of small gates, which in turn control the movement of ions between the interior and exterior of the neuron.In the Hodgkin-Huxley approach it is assumed that gates can be in either of two states, permissive or non-permissive.Dependence between these states is described with the following equations: where the first term (α i (V ) (1 − i)) represents the transition of a particular gate from the non-permissive to permissive state, while the second term (β i (V ) i) -the transition from the permissive to non-permissive state.Sigmoid functions α (V ) and β (V ) are of the following form:

Deterministic Kinetic Model of the Biological Neuron
A kinetic extension of the Hodgkin-Huxley model requires that processes which take place on the membrane are described with Markov kinetic schemes.The dynamics of the potential change on the membrane of the neuron can be written in the following form [22]: In the kinetic model of neuron, sodium and potassium gates can be in eight and five states, respectively.The relationship between these states is presented with Markov kinetic schemes of the following forms [22]: The states of each of the kinetic schemes describe the permeability of the membrane with respect to particular types of ions.In the scheme for sodium gates, [m 3 h 0 ] represents a fully permissive state in which the flow of sodium ions between the interior and the exterior of the neuron is possible.In the scheme for potassium gates, the permissive state is denoted by [n 4 ] [27].

Stochastic Kinetic Model of the Biological Neuron
In the stochastic approach, the number of gates that in a given moment change the state is taken from the binomial distribution, which under certain assumptions can be approximated with the normal distribution [8].Drawing the numbers of gates from a normal distribution is performed with the True Random Number Generator presented in [11].
Let us assume that at time t there are n A gates in state A and n B gates in state B. Coefficient r AB represents the rate function that describes the transition of a single gate from state A to state B.. Then we can determine the probability of transfer of one gate from state A to B between moments t and t + Δt as p = Δt • r AB .Hence, for every step of time we can obtain the number of gates Δn AB that transfer from state A to state B by choosing a random number from the binomial distribution, where n = n A and k = Δn AB .If we assume that μ = Δn AB • p and σ = Δn AB • p • (1 − p) we can approximate the binomial distribution with the normal distribution [8].
A detailed description of the kinetic formalism can be found in [4].

Training Algorithm
It has already been shown [5][6][7] that it is possible to train the Hodgkin-Huxley neuron model by manipulating its parameters.In [5][6][7] α (V ) and β (V ) are rewritten in the following form: where V α n , V α m , V α h , V β n , V β m and V β h together with g Na , g K and g L constitute the weights of the model.
In our approach we use the gradient descent algorithm to train the stochastic kinetic model of the biological neuron [25].This training method allows us to adjust the weights (in our case only g Na , g K , g L ), so that the potential waveform could fit the given target potential.
In the process of determining the value of the potential V according to the stochastic kinetic model, functions α (V ) and β (V ) play an auxiliary role, while they take part in drawing numbers from a normal distribution.That is why we do not need to know the exact influence of parameters V α n , V α m , V α h , V β n , V β m and V β h on the functions α (V ) and β (V ) and thus we do not treat them as weights, so their values would remain as default: The gradient descent algorithm works as follows: 1. Define the problem (minimization of error function E).
2. Determine initial values of weights w 1 , w 2 , . . ., w n (in our case g Na , g K , g L ). 3. Determine the value of gradient of the error function: 4. Update the values of weights according to the rule: (where η is the learning rate) until either the end condition is met: or the imposed number of iterations is reached.
We can write the minimized function as the mean-square error [5][6][7]: where V is the potential obtained from the neuron model and V * is the target of the training (target potential).In comparison with [5][6][7], where nine weights were assumed, we consider only three weights, namely g Na , g K and g L rewritten in the form [5][6][7]: where w represents the default value of the considered parameter, while w -the adopted weight and: We can rewrite the equation for the dynamics of the potential change on the membrane in the following form: where If we want to know the influence of particular parameters on Eq. 17, we can formulate a differential equation for each parameter: where hence the differential equations system: where The gradient of the minimized function can be written in the form: Update of the weights can be done either by updating the parameters after simulating the neuron model for time T and integrating the error gradient according to (23), or by the following scheme [5][6][7]: where and T a = T , η = 0.01.In the above procedure parameters are updated on-line with the running average of the gradient [5][6][7].

Experimental Results
The first application of the trained stochastic kinetic model of neuron is the problem of approximation.As the target of the training (approximated function) we use the potential obtained from different models of a biological neuron (the Hodgkin-Huxley model of a neuron with a point-like structure and the Hodgkin-Huxley model of a neuron with a dendritic structure).
Figure 1 shows three potential waveforms.The first one is the potential obtained from the Hodgkin-Huxley model of neuron for I = 40 [μA] and it is set as the target of the training.The second and third waveforms were obtained in the training of the Hodgkin-Huxley and the stochastic kinetic model of neuron, respectively.
The results from the Hodgkin-Huxley and the stochastic kinetic model of neuron are similar.This means that we can replace the Hodgkin-Huxley model with the stochastic kinetic model.This will give us the implementation benefits related with the reduction of calculations resulting from the formulation of the model and from the reduction of the number of weights in the training process.Additionally, Fig. 2 shows the behavior of a trained stochastic kinetic model for different values of .The target potential was obtained from the Hodgkin-Huxley model of a dendritic structure of the neuron [12].The first waveform is the target potential, while the remaining ones are the waveforms of potential obtained during the training process.Note that if the value of is too small, then it distorts the results.It happens when the target potential is of the same order as .That is why it is important to properly choose the initial values of all parameters.
Figure 3 presents the results of training of the stochastic kinetic model, where the number of iterations was set to different values.With the increase in the number of iterations the accuracy of the trained neuron model improves.However, increasing the number of iterations above 200 does not give better results but only lengthens the time of training.
To emphasize the difference between the Hodgkin-Huxley and stochastic kinetic model of neuron, in   Additionally, in our previous research we examined thoroughly the differences between a deterministic and stochastic kinetic model of a biological neuron.Among other indicators we have made a comparison of the number of gates that change their state in a specific time step for both versions of the model.In paper [24] we present our results which show that stochastic kinetic model due to the simplification of the differential equations to the mathematical rules can significantly reduce the training time without loss of the neuron's properties.
The generalization ability of the stochastic kinetic model of neuron has been thoroughly tested and confirmed in [27].

Application
The AHRS (Attitude and Heading Reference System) makes it possible to calculate the position of an object in space.The system consists of sensors that provides information about the three degrees of freedom related with circular motion along axes x, y and z.It consists of the accelerometer, gyroscope and magnetometer -sensors created in the MEMS (Micro Electro-Mechanical Systems) technology [3].The system makes it possible to determine the position of an object in space based on linear and angular acceleration, direction and the magnitude of Earth's magnetic field.
As we said earlier, determining the Euler angles using AHRS is computationally expensive.However, to control a real object it is necessary to perform all the calculations in real time.That is why we were seeking for other solutions, which would speed up the calculations.Hence the idea of using a recurrent neural network and since the results were not precise enough [18], we combined it with a trained model of the biological neuron.
We used the structure shown in Fig. 4, built from the Elman recurrent neural network and three models of a biological neuron.We tested many different structures of the Elman recurrent neural network and chose three for further tests, as they gave the best results.
The input of the neural network is a set of nine signals collected from three sensors (accelerometer, gyroscope and magnetometer) with respect to three axes.The output renders the values of three Euler angles (Roll, Pitch, Yaw).For the hidden layer we chose three options: -20 neurons in the hidden layer, 10 delays from the hidden layer to the input layer, -30 neurons in the hidden layer, 10 delays from the hidden layer the input layer, -50 neurons in the hidden layer, 10 delays from the hidden layer to the input layer.
A detailed of the Elman neural network can be found in [18,19].The outputs of the Elman network are connected with three models of a biological neuron.The task of trained models of a biological neuron is to smooth the waveform obtained from the Elman network.
Input data is shown in Figs. 5, 6, 7.  angle and the output of the trained stochastic kinetic model of a biological neuron.This difference is calculated according to the equation: where V * is the target potential (expected value of the particular Euler angle) and V is the output of the trained stochastic kinetic model of neuron.Note that regardless of the angle type, this difference is always of the order 10 −4 .In Fig. 8 we additionally present the zoom of the chosen segments of waveforms presented in A and B, and A and C, to show that the output of the trained stochastic kinetic model of neuron is very precise.
Tables 3, 4 and 5 present root-mean-square errors (RMSE) between expected values of Euler angles and values of angles obtained using the Elman recurrent neural network, and Hodgkin-Huxley and stochastic kinetic models of biological neuron.
Training of the Elman recurrent neural network, depending on the number of neurons in the hidden layer: In case of the Elman recurrent neural network, the RMSE is lower for the structure of network with 30 neurons in the hidden layer than for 20 neurons.However, increasing the number of neurons in the hidden layer to 50 does not significantly decrease the value of the RMSE.Training the neural network with a bigger structure requires greater computational effort and is much more time consuming.The structure with 30 neurons in the hidden layer is satisfactory, especially since the results obtained using the Elman neural network are further processed.
Although the results obtained using the trained Hodgkin-Huxley model are similar to those obtained using the trained stochastic kinetic model, it is important to remember that in the case of the stochastic kinetic model there is the aspect of modelling the unpredictable nature of a biological neuron.Additionally, training of the stochastic kinetic model is much faster than of the Hodgkin-Huxley one (Table 2).

Discussion
The algorithm presented in this paper simplifies and speeds up the process of training of the stochastic kinetic model of neuron.The simulation of the model is faster; moreover, the reduction in the number of weights results in faster training process [10,24].
The presented application confirms the usefulness of introduction of the training process into biological neural networks.These networks exhibit associative properties [20], which gives them a great advantage over conventional artificial neural networks.A trained model of the biological neuron solves the problem of finding the Euler angles based on samples taken from an accelerometer, magnetometer and gyroscope.An artificial neural network used in the same problem did not return satisfactory results.
This paper concerns mainly the procedure of the training of the stochastic kinetic model and not the AHRS algorithm itself.We think that it is necessary to continue this research, where presented in this paper solutions would be compared with other AHRS algorithms.
It is also necessary to consider other architectures of the artificial neural networks, while in this paper we focus only on shallow structures of the Elman recurrent neural networks.Presented in this paper Elman neural network is also considered in our other research projects that concern object's position in space.At first we used these neural networks to obtain Euler angles in [18] and then combined them with a model of a biological neuron.In our other research [15], we examined also other structures of neural networks in order to detect sensor failure in a robot.One of the obvious future steps is to consider other machine learning methods, especially deep neural networks and among them graph neural networks.
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http:// creativecommons.org/licenses/by/4.0/),which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.
Rafał Kapela began his research career during his Master's studies at Poznan University of Technology (PUT).Initially he was involved in projects connected to control and robotics, as well as artificial intelligence.During that time he proposed new obstacle avoidance algorithms for anthropomorphic robot manipulators, and a gesture recognition system based on neural networks.After receiving the title of Master of Science in year 2005, he was employed in the Department of Computer Engineering at PUT as a PhD fellow.That was the moment when he started professional research on the topic which is his passion-digital image and video processing.During the few years he held this assistant position, he was involved in a range of scientific projects in many areas, including hardware image/signal processing, hardware implementations of neural networks, and an analysis of RNA chains for medical purposes.His main focus, however, was on image content description based on visual descriptors and artificial intelligence.After receiving a PhD deegree in August 2009 he had the opportunity to join a new team of design-for-test engineers at Mentor Graphics, located in Poznan.After this Rafal joined CLARITY -a research centre in Dublin City University as a Marie Curie research fellow with his individual research project for real-time sports event detection system called VISION.After returning to Poland he was involved in number of scientific and industrial reseach projects including: AXIOM (an open-hardware 4K camera), deep learning based automatic asphalt surface categorization, FPGAbased stereovision system and many others featuring FPGAs and GPUs as the universal hardware accelerators for real-time embedded vision processing tasks.

Fig. 1
Fig. 1 Waveforms of potential: a. the target potential, b. the result of the trained Hodgkin-Huxley model, c. -the result of the trained stochastic kinetic model

Fig. 2
Fig. 2 The output of the stochastic kinetic model of neuron: a. the target potential, and the results for different values of : b. 10 −4 , c. 10 −6 , d. 10 −7

Fig. 3
Fig. 3 The output of the stochastic kinetic model of neuron for different numbers of iterations: a. the target potential, b. no training, c. 10 iterations, d.50 iterations, e. 100 iterations, f. 200 iterations

Figures 8 ,
9 and 10 show the values of the original Euler angles (expected values obtained with the AHRS algorithm) and values obtained with the Elman neural network and the trained stochastic kinetic model of neuron.Additionally in each figure we present the difference between the Euler

Fig. 10
Fig. 10 Euler angle along the z axis (Yaw) obtained with: a. AHRS, b.Elman neural network, c. stochastic kinetic model of a biological neuron; d.The difference between a and c

Table 1
The parameters of Hodgkin-Huxley model

Table 2
we present the times of training of these models for different numbers of iterations (hardware specification: 64-bit