A Deep Neural Network Model for Predicting Electric Fields Induced by Transcranial Magnetic Stimulation Coil

This article proposes a deep neural network (DNN) model to predict the electric field induced by a transcranial magnetic stimulation (TMS) coil under high-amplitude and low-frequency current pulse conditions. The DNN model is comprised of an input layer with 6 neurons, three non-linear hidden layers with a total of 1088 neurons, and a linear single output layer. The model is developed in Google Colaboratory environment with TensorFlow framework using six features including coil turns of single wing, coil thickness, coil diameter, distance between two wings, distance between head and coil position, and angle between two wings of coil as the inputs and electric field as the output. The model performance is evaluated based on four verification statistic metrics such as coefficient of determination (R2), mean squared error (MSE), mean absolute error (MAE), and root mean squared error (RMSE) between the simulated and predicted values. The proposed model provides an adequate performance with $\text{R}^{2} =0.766$ , MSE = 0.184, MAE = 0.262, and RMSE = 0.429 in the testing stage. Therefore, the model can successfully predict the electric field in an assembly TMS coil without the aid of electromagnetic simulation software that suffers from an extensive computational cost.


I. INTRODUCTION
Transcranial magnetic stimulation (TMS) has shown an effective therapeutic outcome for some neural disorders such as major depressive disorder, traumatic brain injury, parkinson's disease, post-traumatic stress disorder, etc. [1]- [4]. The TMS technique requires a magnetic coil normally placed on the subject's head that is fed with a high-valued short-duration current pulse [5]. The electric current conveyed in the coil produces a magnetic field that results in an induced electric field inside the brain tissues [6]. Then a localized axial depolarization is formed by the induced electrical field in the underlying cortical tissue which has a therapeutic effectiveness of neural disorders [7]. To ensure a greater therapeutic The associate editor coordinating the review of this manuscript and approving it for publication was Rajeswari Sundararajan . effect, the induced electric field should have to be strong enough so that it can depolarize the target neurons that are responsible for the neural disorders [8], [9]. Moreover, some other factors including focality (area of stimulation) and depth (distance from vertex) of the induced electric field are associated with the effectiveness of TMS treatment. The commercially available single coils named as figureeight, halo, circular, double cone, H, etc. are suffering from the trade-off between stimulation focality and depth. For instance, the figure-eight coil aims to generate a concentrated electric field within a smaller region rather than stimulating the deeper brain structure. Alternatively, the H-coil increases the stimulation depth by maintaining a moderate focality. The Halo coil also stimulates the deep brain structure but it degrades the focality. Thus, in the recent research the development of an assembly coil (combination of single VOLUME 9, 2021 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ coils) is emphasized to maintain a trade-off between stimulation depth and focality [10]. As the electric field intensity is highly sensitive to numerous factors such as subject head anatomy, coil positioning, coil configuration, etc., iterative computer simulation is required to determine the desired electric field intensity inside the brain tissues. However, the problem associated with the electric field enumeration is that the computational time is generally high for the commercial electromagnetic (EM) simulation software [11], [12]. Moreover, the computational time is related to the development of a human head model and the estimation of the electric field with the aid of a volume conductor model [13], [14]. The important bottleneck is that it take a few hours to couple days to design a TMS coil on a human head model as well as to compute the electric field. Therefore, the application of the deep learning (DL) approach could effectively resolve the computational cost issue [15]. Generally, the DL approach uses a layered structure of algorithm called artificial neural network (ANN) to solve several problems such as classification [16]- [19], regression [20]- [22], clustering [23], [24], and prediction [25]- [27]. Another advanced technique over shallow ANN called deep neural network (DNN) can develop a complex non-linear relationship with higher generalization capability by employing multiple hidden layers between the input and output [28] to compute optimum induced electric field.
Recently, very few researches have been reported to compute induced electric field of TMS coil in head model through DNN model. For example, Yokota et al. [11] proposed a DNN model to estimate the electric field of TMS coil in head MR images at different coil positions. They created datasets with the help of SimNIBS and FreeSurfer segmentation softwares to train and test the U-Net DNN model. The FreeSurfer software converted the MR image into a 3D head model and the SimNIBS software calculated the electric fields by the finite element method at varying positions of the figure-eight coil. Thereafter, the DNN model was trained with created datasets for mapping the electric field to the MR images. In another work, Afuwape et al. [12] utilized a deep learning method to predict electric field into T1-weighted MR images with varying coil configuration. The 3D head model was generated from the MR image and the finite element analysis was performed in Sim4Life software for sixteen different coil configurations. Then the deep convolutional neural network was trained using the generated dataset to predict the electric field of TMS coils in 3D head model.
Both of the models could estimate the electric field accurately within a short time. However, the segmentation process (3D head model generation) is time-consuming as well as complicated due to the generation of both brain and skull parts. It is also quite challenging to develop an accurate head structure from low contrast MR images. Besides segmentation time, both models take a longer training time to process the data with the deep network architecture. Moreover, the estimation of the electric field is done based on the single coil and single design parameter of coil positioning. Since, the induced electric field value is dependent on different coil designing parameters such as the coil turns, coil thickness, coil angle, coil diameter, etc. [29], the optimum field calculation based on these parameters is essential for a safe and effective TMS treatment. Moreover, the advantages associated with the tradeoff between focality and depth of induced electric field cannot be achieved by the single stimulation coil but can be achieved by assembly coil. Thereby, in this work a simple DNN approach is proposed for the prediction of electric field induced by TMS assembly coil, which directly regresses electric field from six different coil designing parameters. This is a numerical data-driven method for predicting electric fields where the mapping of coil modeling parameters to the electric fields is achieved using a training dataset consisting of pairs of design parameters and the relative electric fields. The mapping is characterized by the model that consist of three non-linear hidden layers between the input and output layers. For the regression task, the model is trained with 100 data samples of six coil design parameters and electric field pairs. After training the deep neural network, the electric field induced by the transcranial magnetic stimulation coil is predicted directly from any TMS coil design parameter. The advantage related to the computation time is that the proposed DNN model requires only 0.04 s of time for computation using a graphics processing unit (GPU). This time is significantly lower compared to the conventional simulation software for the determination of the electric field induced by the TMS coil.
The primary contributions of this work are outlined as follows: • A DNN approach as a nonlinear regression model to predict the induced electric field value from assembly TMS coil under high-valued and low-frequency current pulse conditions is proposed.
• The data normalization process is used for the input dataset before feeding to the proposed DNN model to arrange different valued input features into a similar format.
• The (6-512-512-64-1) DNN is modeled with a total of 1095 neurons for learning the complex behaviors of coil designing parameters and corresponding induced electric field from the input and output datasets.
• The performance of the proposed model is evaluated by analyzing the four regression matrices to predict the electric field from the assembly TMS coil.
The residual part of the paper is organized as follows: Section II presents the detailed explanation of the proposed methodology. The result is described in detail with some performance measures in Section III. Discussion and comparison with the existing works are done in Section IV. The conclusion and future directions of the paper are drawn in Section V.

II. PROPOSED APPROACH
The system architecture of the proposed DNN based prediction model is shown in FIGURE 1. The input and output of the proposed DNN model are the coil design parameters and the induced electric field respectively. The inner configuration of the DNN model with three non-linear hidden layers build a complex relationship between input parameters and output electric field. FIGURE 2 illustrates the workflow diagram of the overall process of the electric field prediction induced by the Halo-V assembly (HVA) TMS coil. In which the prediction process starts with the collection of data samples (h, [x 1 ; x 2 ; . . . ; x 6 ] , E) ∈ D from the mathematical model consisting of head anatomy, h, coil design parameters [x 1 ; x 2 ; . . . ; x 6 ] and its corresponding induced electric fields, E. Then the preprocessing technique is performed just before splitting the dataset into a train, D train and test, D test sets. After that, the proposed DNN based regression model with the setting of optimal hyperparameters values is introduced for supervised learning using the training dataset. Finally, the electric field prediction, E pred is performed using the test data on the trained DNN model with the evaluation of reasonable values of performance matrices. The details of the electric field prediction steps are described in the subsections below.
A. GEOMETRIC STRUCTURE OF HVA COIL WITH TWO SHELL HUMAN HEAD MODEL FIGURE 3 illustrates the cross-section of the two-shell human head model with a HVA coil configuration. The head model is comprised of two different anatomical layers including the skull and tissue fluid. Both layers are indicated in the inset of the three-dimensional head model in the Cartesian coordinates system. The outer and inner radius of the skull structure are 85 mm and 80 mm respectively, while the inner part of the skull i.e., the fluid tissue region is modeled with a radius of 80 mm. The HVA stimulation coil consists of two coils including halo coil and V coil. These two coils have a different number of turns such as: 9 for both wings of the V coil and 5 for the halo coil which makes a total of 23 turns. The V coil part of the HVA coil is placed at a distance of 5 mm from the vertex of the head model. Similarly, the halo coil part is placed at 90mm from the vertex of the head model. The design parameters of the HVA coil are summarized in Table 1. Each of the coils is modeled by considering the torus shape of copper material with an electrical conductivity of 5.8 × 10 7 S/m. The electromagnetic properties of materials implicated in this model are listed in Table 2 [30], [31]. For coil excitation, a current pulse with the high amplitude of 5000A and low-frequency of 2500 Hz are applied in the coil domain.  of the charge carrier in the closed-loop coil generates a magnetic field in the direction perpendicular to the coil surface. As a result, the changing magnetic field induces an electric field in the conductive head tissue medium. Equations (1) to (4) presented in differential form are used to represent the generated magnetic field and induced electric field [32]. Here, J and J e represent the current density vector and the externally generated current density respectively. The magnetic potential and intensity vector are indicated by A and B. Moreover, the induced electric field intensity and Based on the above equations the electric field intensity value is evaluated in COMSOL Multiphysics 5.0a software. In the simulation, the total model domain including head and coil geometries are divided into several sub-domains for solving the governing equations [33]. The free tetrahedral meshing elements are considered for simulation that ensures an effective numerical accuracy in a low computational time.

B. DATASET CREATION
For two shell head model (h), the electric fields, E n are computed for six different parameters of HVA coil including coil turns of single wing (x 1 ), coil thickness (x 2 ), coil diameter (x 3 ), distance between two wings (x 4 ), distance between head    and coil diameter are negatively skewed and they have a great impact on the prediction model. The correlation between two quantitative attributes is visualized based on the correlation matrix heatmap as shown in FIGURE 5. Analysis of correlation matrix provides six important unique input features such as coil turns of single wing, coil thickness, coil diameter, distance between two wings, distance between head and coil position, and angle between two wings of coil that are more correlated with the outputs feature of electric field. FIGURE 5 indicates that the strong relationship between the attributes gives a high correlation value whereas hardly related attributes provide low correlation value. Moreover, the scatterplot matrix shown in FIGURE 6 provides information about the structured relationship between the attributes. From the first row of the scatter plot matrix, it is obvious that the scatter plot of the output electric field is the function of all input features. Similarly, each input feature is the function of the output electric field as presented in other rows. The join distributions of three input features (i.e., coil turns of the single wing, coil thickness, coil diameter) and output feature VOLUME 9, 2021  (i.e., electric field) are shown diagonally in the scatterplot matrix. The statistical analyzes based on mean, standard deviation, minimum, and maximum values are conducted to examine the feature-wise values that are summarized in Table 4. From this table, it is seen that the range of each feature is different from others. The minimum and maximum ranges of all features are set to a considerable value to remove bad working points. All the input and output features in the dataset are in numeric forms as continuous measurement data. Consequently, the normalization technique is applied for numeric features prior to training the proposed DNN model. The normalization technique coerces the values of all features into a distribution centered around 0 with a standard deviation of 1 by precomputing the mean and variance of the features as shown in Table 4. The numeric original feature and the corresponding normalized features are depicted in FIGURE 7.

D. PROPOSED DNN MODEL
In a DNN model, the number of nodes in hidden input and output layers are identical to the numbers of input and output features [34]. However, the number of nodes and hidden layers can be varied depending on the complexity of the problem and the data set. The proposed DNN model architecture as shown in FIGURE 8 comprises of an input layer with six nodes, three fully connected (dense) hidden layers with 512-512-64 nodes for the first, second, and third layers respectively, and an output dense layer with one node for the prediction of electric field, E pred . The electric field value can be calculated by using equation (5) as: where W

(k)
i,j is the weight connecting to the ith unit in kth hidden layer and jth unit of previous layer, and b (k) i is the bias connecting the ith unit in the kth hidden layer. A nonlinear transfer function called rectified linear unit (ReLU) is selected for the hidden layers that provides a non-linearity to the DNN regression model. ReLU is defined as: where, A linear transfer function is also assigned for the output layer to predict the single electric field value. The mean absolute error loss function is chosen for the model to determine the optimum values of trainable parameters such as weight, W (k) i,j and bias, b (k) i . Then, the Adam optimizer is selected with a default learning rate of 0.001 to minimize the loss function [35]. The optimizer minimizes the loss function by updating the trainable parameters with its gradients that are found by the backpropagation method. The entire dataset used for the model is divided into two sets with an amount of 80% for the training, and the residual 20% for testing.

III. RESULTS
In this work, the 6-512-512-64-1 DNN model with 299,150 trainable parameters achieve the best performance for the purpose of electric field prediction. Table 5 summarizes the results of four verification matrices such as coefficient of determination (R 2 ), mean squared error (MSE), mean absolute error (MAE), and root mean squared error (RMSE), which are commonly used to analyze the model prediction. Equations (8) to (12) are employed to define the four above-mentioned metrics. Here, y true indicates the true output, y pred indicates the predicted output, and the mean of the ground truth output is represented as y mean . The total number of data is denoted as n. The R 2 metric represents the quality of the proposed DNN regression model. It determines how well the model predicts the electric field value. To perfectly fit the data of the regression prediction model, the value of R 2 is considered to be equal to 1. However, the regression loss function, MSE is calculated by summing the squared of distances between the true value and predicted value. The value of MSE = 0 is preferable. Another loss function called MAE is measured by averaging all absolute errors. RMSE is also calculated by the square root of the sum of square deviation of true and predicted values over the total number of data n. For perfectly fitting the predicted values to the true values, the RMSE = 0 is desirable.
The training process of the proposed DNN model against 100 iterations (epochs) is shown in FIGURE 9, in which the  training and validation loss are found equal at 20 epochs. After 20 epochs, both errors are started to decrease at an optimum level and the finest result is achieved within the epochs of 90 to 100. The predicted electric field values are plotted against true electric field values (simulated values) for the proposed model which is shown in FIGURE 10. The graph indicates that the prediction accuracy of the proposed DNN model is good enough as the predicted electric field values are quite similar to the simulated electric field values. Therefore, the proposed model has the capability to predict the electric field values ranging from 130 V/m to 300 V/m in an accurate manner. Moreover, the prediction accuracy of the model as a function of single input feature (i.e., coil turns of single wing) is shown in FIGURE 11. For a range of values of input feature, there is a considerable number of accurate predictions of the electric field values of the HVA TMS coil under high amplitude and low-frequency current conditions.

IV. DISCUSSION
The main advantage of the proposed DNN model is that it can estimate the induced electric field in a head model much faster way than the electric field determination process by an EM software. The electric field computational time for the proposed DNN model and simulation software are determined. Table 6 represents the computation time to estimate the induced electric field in a head model from a HVA TMS coil. The expected values of computation time using GPU and CPU for the proposed DNN model are found 0.04 s and 1.98 s respectively. On the other hand, the required computation time for COMSOL Multiphysics software is found 6 min 15 s even though this estimated time exclude the construction time of anatomical head and coil model. If the construction time of anatomical head and coil model is considered then it will be few hours. Moreover, the performance comparison of the proposed DNN based approach with the couple of similar state-of-theart approaches is presented in Table 7. The works reported in in [11], [12] also used DNN model to estimate electric field but they used single coil and single coil parameter to determine electric field. Single coil is not suitable for the trade-off between stimulation focality and depth [10]. For getting optimal treatment efficacy and minimal side effect, focality and depth trade-off is essential. Thus, DNN based electric field estimation for assembly coil with multiple coil parameters is done in this work. Table 7 indicate than that the proposed model can predict electric field for several coil parameters at a bit lower R 2 value. However, the lower value of R 2 in compare to the existing works is found because of the lower number of training datasets used. The value of R 2 can be improved by employing several data increment methods. Since, the use of an assembly coil rather than a single coil can provide optimum therapeutic support to the neural disorder patient, the optimum electric field determined from an assembly coil for varying coil parameters can provide an effective and safe stimulation during treatment against neurological disorders.

V. CONCLUSION
This paper introduces a DNN based regression model for predicting electric field induced by HVA transcranial magnetic stimulation coil inside a head model. The database uses for training the DNN model consists of 100 simulated data. These 100 data are obtained for different coil parameters. The model exhibits reasonable prediction accuracy of R 2 = 0.766 which ensures the ability of the model to predict electric field for HVA coil with varied parameters. Moreover, the model can efficiently estimate electric field in a very short time of 0.04 s without any requirement of the mathematical or three-dimensional model for human head phantom and TMS coil. Thus, the proposed DNN model can effectively reduce the electric field computation cost and help manufacturer to build an optimum coil for the treatment of the certain neurological disorder. In future, data augmentation process can be used to increase the number of datasets and to reduce the overfitting problems related to the model. Moreover, the critical stimulation parameters including focality and depth can also be considered as the predictive values to reduce the possibility of undesired side effect with the aid of other optimization algorithms including differential evolution, genetic algorithm, particle swarm optimization, etc. He has been working in the area of antenna and biomedical engineering for last ten years. He has published a number of research articles in this field. His research interests include development of miniature electronic devices, brain stimulation, antennas and its application in brain stimulation, design and analysis of power electronic devices, and modeling and simulation of biosensors. He, with his dedicated research team, is looking forward to explore brain stimulation and antennas in biomedical applications through extensive research and analysis of various stimulation parameters, devices, antenna parameters, and bio-compatibility. He is a member of the Institute of Engineers Bangladesh (IEB).