## 2 Material and Methods
Several theoretical foundations support the effectiveness of stacking:  
Bias-Variance Tradeoff: Stacking mitigates bias by incorporating multiple perspectives from diverse base models while reducing variance by averaging out overfitting tendencies of individual learners [36]. The meta-learner, trained on the predictions of base models, acts as a higher-level function that smooths the decision boundary and enhances robustness [37]. Universal Approximation Property: Theoretically, a sufficiently expressive meta-learner can approximate any function of the base models' outputs, ensuring that stacking can asymptotically match or exceed the performance of its best component model [38]. Convex Combination and Model Averaging: When the meta-learner assigns weights to base models, it effectively performs a weighted averaging of predictions. Under convex loss functions, this form of ensembling is known to improve generalization bounds, as shown in studies on weighted model averaging [39]. Error-Correction Theory: The meta-learner operates as an error-correction mechanism, learning to identify and adjust for systematic mistakes made by base models. This aligns with the principles of boosting, where weak learners iteratively refine decision boundaries to compensate for previous errors [40]. Transfer learning-stacked generalization was introduced in the following manner: (a) the output (single or multiple value) of one pretrained FFNN was used as an input to a second, untrained FFNN (Figure 2); (b) the output (single or multiple value) from the pretrained FFNN was combined to the input of the MEG data to the untrained FFNN (Figure 3); (c) the single-value classification output from several pretrained FFNNs was combined to an input of the MEG data to the untrained FFNN (Figure 4); or, (d) a chain was built with FFNNs trained by a combination of the MEG data and the output of the previous FFNN model (Figure 5). Figure 2: The output of one pretrained FFNN was used as an input to an untrained FFNN. In the first case, we used a 4-hidden-layer FFNN (sizes 64, 32, 32, and 16 hidden neurons, respectively) pretrained on the combined input of the MEG signal values with the ST-FFT spectral values--a total of 516 values, as explained in the experiments of Group  
Figure 4: The outputs from several pretrained FFNNs were combined to an input of the MEG data to the untrained FFNN. Figure 5: A chain of FFNNs trained by a combination of the MEG data and the output of the previous FFNN model. Figure 3: The output from the pretrained FFNN was combined with an input of the MEG data to the untrained FFNN. III--and then a new FFNN was created and configured for 16 outputs (and 32 outputs for the second experiment). We then copied the parameters of the first four layers of the pretrained network to the new network, thus cloning the pretrained network, but now the clone gives an output of 16 (or 32) values. The idea was to feed the untrained FFNN with more input data from the pretrained network than just a single numeric value per item. Finally, we created a 5-level untrained network and trained it with the output of the pretrained network. Testing the FFNN on the Test Dataset gave poor results. The prediction accuracy was similar, even lower than that of the original pretrained model. In our second series of optimization experiments (Groups V, VI, and VII), we combined the output of the pretrained network with the original input of the MEG data (256 values of the signal samples and 260 values obtained from the ST-FFT) to the untrained FFNN (Figure 3). We tested both pretrained networks with multiple value outputs and pretrained networks with single value outputs, with the latter being much easier to use because there was no need for any special configuration. All experiments gave a small improvement in the models' performance compared to that of the pretrained model but had no significant differences among them. The gain from the use of multiple-value output was approximately the same as the gain from the use of single-value output.