# Fed-DeepONet: Stochastic Gradient-Based Federated Training of Deep Operator Networks
## 4 Numerical Experiments  
This section tests the efficacy of the proposed Fed-DeepONet framework. To this end, we use four experiments. In the first experiment (see Section 4.1), we compare the federated training performance of the two proposed algorithms: Algorithm 1 (Fed-DeepONet) and Algorithm 2 (Adaptive Fed-DeepONet). In the second experiment (see Section 4.2), we employ the Adaptive Fed-DeepONet to learn the solution operator of a pendulum. In the third experiment, we verify how the performance of Fed-DeepONet changes when we vary the data heterogeneity. In the final experiment (see Section 4.4), we approximate the dynamic response of a library of pendulums using an Adaptive Fed-DeepONet. Let us start this section by describing the neural networks used for DeepONet, the distributed training dataset, and the metrics used to evaluate Fed-DeepONet. _Neural networks._ To build the Branch and Trunk networks, we used feed-forward neural networks. For the Branch, we used 1 hidden layer with a width of 50 neurons. Further, the Branch's input and output layers have, respectively, \(m\) (defined later) and 50 neurons. For the Trunk, we also used 1 hidden layer with 50 neurons. The Trunk's input and output layers have, respectively, 1 and 50 neurons. We obtained these values for the design of the Branch and Trunk networks after employing a simple routine of hyper-parameter optimization. For the activation function, we employed the classical ReLU function. We coded these neural networks in PyTorch and published the code on GitHub. _Training dataset._ For each experiment, we collected, using the true operator \(G\), \(N=10{,}000\) training data triplets, i.e., \(\{u_{m}^{(k)},y^{(k)},G(u_{m}^{(k)})\}_{k=1}^{N}\). Then, we distributed these training data triplets among the \(C\) clients without repetition. Note that in these experiments, we used the number of clients \(C\) as a parameter to test the performance of Fed-DeepONet. MetricsTo test the performance of Fed-DeepONet, we computed the \(L_{2}\)-relative error between solution trajectories. That is, for a given discretized input \(u_{m}\), we use the trained Fed-DeepONet (denoted as \(G_{\theta^{*}}\), where \(\theta^{*}\) is the vector of trained/optimized parameters) to predict the solution trajectory \(\hat{V}_{u_{m}}:=\{G_{\theta^{*}}(u_{m})(t):t\in T_{m}\}\) at a collection of selected points \(T_{m}\subset[0,T]\). Let \(V_{u_{m}}:=\{G(u_{m})(t):t\in T_{m}\}\) denote the solution generated by the true solution operator \(G\), then we compute the \(L_{2}\)-relative error as follows:  
\[e_{L_{2}}:=\frac{\|V_{u_{m}}-\hat{V}_{u_{m}}\|_{2}}{\|V_{u_{m}}\|_{2}}\cdot 100\%.\]  
Pendulum systemIn this section, we study the performance of Fed-DeepONet (Algorithm 1) and Adaptive Fed-DeepONet (Algorithm 2) using the following pendulum system with dynamics:  
\[\frac{d}{dt}x_{1}(t) =x_{2}(t), t\in[0,T], \tag{9}\] \[\frac{d}{dt}x_{2}(t) =-k\sin x_{1}(t)+u(t).\]  
The parameters used to describe the above pendulum dynamics are the simulation time-horizon \(T\), the pendulum's constant \(k\), and the initial condition \(x_{0}\). In our first and second experiments (Sections 4.1 and 4.2), we selected \(T=1.0\) s, \(k=1.0\), and \(x_{0}=(0,0)\). These are the same parameter values used in the original centralized DeepONet paper [10] and our proposed centralized Bayesian DeepONet paper [26]. For our fourth experiment, we allowed \(k\) to take values within the interval \([0.5,1.5]\). We selected this arbitrary interval to showcase the ability of the Adaptive Fed-DeepONet to approximate libraries of parametrically complex dynamical systems (e.g., pendulums). Finally, we want to remark that, in practice, the values for these parameters depend on the dynamical system under study.