# Ionospheric Electron Density Model by Electron Density Grid Deep Neural Network (EDG-DNN)
## 2 Materials and Methods
### COSMIC_DNN Model Introduction  
The purpose of this paper is to build a four-dimensional gridded electron density model with longitude, latitude, altitude, and time using a deep-learning neural network and the COSMIC electron density data profiles. The electron density data in the ionospheric electron density profiles are large and discrete across the entire ionospheric space, making it difficult to obtain a global ionospheric model with high resolution and covering time and space using traditional mathematical methods. Deep learning, on the other hand, has powerful data-processing capabilities that allow a DNN to understand the distribution features of the data as well as the relationship between the data, and thus obtain a gridded global electron density distribution from the irregular input. Figure 2 shows the basic algorithm flow of DNN. The internal structure of the DNN algorithm is very similar to the traditional neural network algorithm, which mainly consists of the input layer, hidden layer, and output layer. Information is transmitted between layers in a fully connected manner. DNN adopts forward propagation and directional propagation algorithms, so it has significant advantages in data fitting. The input matrix of the input layer (\(X\)) and the input matrix of the hidden layer (\(A\)) can be expressed as:  
\[X= \begin{bmatrix}x_{1}\\ x_{2}\\ \vdots\\ x_{m}\end{bmatrix} ,A= \begin{bmatrix}a_{1}\\ a_{2}\\ \vdots\\ a_{n}\end{bmatrix} \]  
The weight of each input (\(x_{i}\)) of the input layer corresponding to each hidden layer (\(a_{j}\)) is \(w_{ij}\), so the weight matrix (\(W\)) is expressed as:  
\[W= \begin{bmatrix}w_{11}&\cdots&w_{1n}\\ \vdots&\ddots&\vdots\\ w_{m1}&\cdots&w_{nm}\end{bmatrix} \]  
Through the action of neurons, the above formula is expressed as:  
\[h_{i}= \begin{bmatrix}w_{1i}&w_{2i}&\cdots&w_{mi}\end{bmatrix} * \begin{bmatrix}x _{1}\\ x_{2}\\ \vdots\\ x_{m}\end{bmatrix} \]  
In addition to the output layer, each neuron in the hidden layer must be activated by the activation function and output to the next neuron, so the formula can be expressed as:  
\[H=W^{\mathrm{T}}X+[b]\]  
\[p_{i}=g(h_{i})\]  
where \(p_{i}\) is the output of neurons and \(b\) is the bias unit. Using the same method for the next hidden layer or output layer, the value distributed between 0 and 1 in the output layer can be obtained. The more hidden layers, the better the generalisation ability of the network and the better the fitting effect, but the complexity of the network will increase accordingly and the training time will increase significantly. For shallow networks, increasing the network width, i.e., the number of hidden layer nodes, can improve the generalisation ability and the fitting effect, but it has little effect on more complex networks. [PERSON] et al. found that decreasing the network depth leads to an exponential increase in the number of computational elements used to fit the function [28]. This means that increasingthe network depth is more effective than increasing the width. The use of five hidden layers allows the model to run with the intended effect while maintaining the model's computational efficiency. After altering the hidden layer nodes, it is discovered that the model performs best when the number of nodes is 256, 128, 64, 16, and 4, respectively. The input dimension is (8,1), and each data are composed of longitude, latitude, altitude, year, day of the year (doy), hour, minute, and corresponding electron density, where the time is Universal Standard Time (UT). Since Solar Zenith Angle (SZA) refers to the angle between the direction of incoming solar radiation and the zenith, which determines the amount of solar thermal energy that can be obtained by ionospheric components and can affect the degree of ionisation of neutral components, it is closely related to the distribution of electron density. Therefore, SZA is also added to the data to strengthen the constraints. The activation function used in this study was _RELU_.