## 2 Materials and Methods
### Setup of the Artificial Neural Network  
Having an appropriate set of learning data at hand, the final practical issue is to design a feasible neural network for computing the above coefficients \(\{a_{j}\}_{j=1}^{4}\). In any case, to keep the computational costs at a low level, this should contain relatively few parameters. Also, since the mapping \(\mathcal{N}\) is nonlinear, we need to incorporate nonzero activation functions. In concrete terms, we have applied the so-called SeLu activation function, which is given with  
\[\text{SeLu}:\mathbb{R}\to\mathbb{R},\ \text{SeLu}(x)=\begin{cases}\alpha_{0}x&x>0 \\ \alpha_{0}\cdot\alpha_{1}e^{x-1}&x\leq 0.\end{cases}\]  
Within the Keras package of Python, we have used the standard parameters \(\alpha_{0}\approx 1.0507\) and \(\alpha_{1}\approx 1.6733\), respectively.  
After a long series of experiments, the following structure is proposed:  
* The input layer is of size 8, obtaining the 8 coordinates of \((\mathbf{x_{1}},\mathbf{x_{2}},\mathbf{x_{3}},\mathbf{x_{4}})\).
* The first hidden layer, a dense one, is of size 4, using the SeLu activation function and a bias term.
* The second hidden layer is again a dense one of size 12 using the SeLu activation function and a bias term.
* Finally, the output layer is also dense and of size 4, and it is equipped with a linear activation function without a bias term.  
The above structure is displayed in Figure 5.  
Altogether, this setup contains 144 parameters, which have to be optimized during the learning procedure. Note that in the majority of the applications of ANNs a much larger number of parameters is used. At the same time, for the efficiency of the algorithm, we need a really simple setup, which is comparable to the complexity of a single matrix-vector product. Also, if we obtain an acceptable accuracy with 144 parameters, a more sophisticated system could suffer from overfitting and would require an extra regularization procedure.  
Figure 5: The structure of the ANN for computing the finite difference coefficients.  
Altogether, the algorithm to build a matrix \(D_{h,\text{FD}}\) for the approximation of the Laplacian consists of the following steps:  
1. Generate randomly perturbed grid points and training data using the least-square approximation for (10).
2. Construct the ANN in Figure 5 and train it using the above data.
3. Construct a quadrilateral spatial grid on the computational domain \(\Omega\).
4. For each grid point \(\mathbf{x}_{0}\) and its neighbors \(\mathbf{x}_{1},\mathbf{x}_{2},\mathbf{x}_{3}\) and \(\mathbf{x}_{4}\), we apply an affine linear mapping to transform the midpoint to the origin and scale one distance to be _one_.
5. We apply the ANN to the above setup and scale back the distances to obtain the finite difference coefficients \((a_{1},a_{2},a_{3},a_{4})\) for the neighboring points.
6. We compute \(a_{0}=-a_{1}-a_{2}-a_{3}-a_{4}\) and have all the coefficients at hand.
7. For an arbitrary function \(u\), we can approximate its Laplacian in all interior points by assembling the matrix \(D_{h,\text{NN}}\).  
Remarks:
1. Note that in Python the above operation of the ANN can also be vectorized, leading to an efficient implementation.
2. We can incorporate any inhomogeneous Dirichlet boundary data, since these values are simply given on the boundary grid points.
3. We could make this procedure completely mesh-free using only grid points. At the same time, using a quadrilateral mesh, the neighbors of a certain grid point can be specified automatically. Also, these kind of meshes are practically useful (see, e.g., [21]) and these can be obtained using the frequently used mesh generators.
4. Here, \(D_{h,\text{NN}}\) has the same structure as \(D_{h,\text{FD}}\) (see the left of Figure 2), but the nonzero entries were computed using our ANN.  
In practical cases, for the numerical solution of (2), we not only have to approximate the Laplacian but we also have to solve a problem given in (6).