## Appendix B  
Different hyperparameters were tested to find a suitable convolutional neural network (CNN) model. This model was trained to recognize trophallaxis in the stingless bees, _Melipona quadrifasciata_, and can be used to recognize many binary behaviors. Using the validation accuracy of such a variable response, the interaction between the dropout and the activation function of the network output was evaluated (Figure 10A). Dropout is a regularization technique that randomly zeros out the input units of a layer, breaking fixed patterns to avoid overfitting [49]. Here, a better response was obtained, deactivating neurons with a probability of 0.2 (dropout = 0.2) (Figure 10A). The higher rates, despite reducing overfitting, decreased the accuracy. The activation function of the network output that presented the best response was the sigmoid function (Equation (A1)) (Figure 10A). This function binarizes the network output (0 or 1). As it involves a binary behavior classification, the sigmoid function is expected to generate better output. \[\bigg{\{}f(x)=\frac{1}{1+e^{-x}},\text{ where }x\text{ is the output from the previously hidden layer}\bigg{\}}.\] (A1)  
The activation function of the inner layers and the optimization method were also evaluated. The best result was obtained with the exponential linear unit (Elu) function, along with mini-batch stochastic gradient descent (mini-batch SGD) as the optimizer (Figure 10B). The Elu function (Equation (A2)) is an identity function for positive values, and it tends smoothly to \(-\alpha\) for negative values. This function saturates for very small (extremely negative) values, resulting in the activation average being close to zero. Thus, ELUs tend to normalize the layer's output, accelerate learning, and increase accuracy [50]. \[f(x)=\bigg{(} \begin{array}{c}x,\text{if }x>0\\ \alpha*(\text{e}^{x}-1),\text{if }x\leqslant 0\end{array} \bigg{)}.\] (A2)  
In the mini-batch SGD, the term stochastic refers to a random sampling of batches in the data. Based on the loss value, the optimizer plays the role of updating the network's trainable parameters (weights). This is executed by calculating the loss gradient concerning the parameters (current weights) of the network. Mathematically, this process is performed by deriving the cost function and finding the gradient of the current weights. Then, the weights are updated in the gradient's opposite direction, reducing the loss slightly with each batch. Since the classification is binary (the output from the network is a probability), binary cross-entropy (Equation (A3)) was used as the cost function. Cross-entropy is a measure of the distance between the expected result \(y\) and the predictions \(p(y)\). \[H_{p}(q)=\frac{-1}{n}\sum_{i=1}^{n}y_{i}*log(p(y_{i}))+(1-y_{i})*log(1-p(y_{i})),\] (A3)  
where \(n\) is the number of network outputs. As an increase in the learning rate tended to decrease the accuracy (Figure 19), the lowest rate tested (0.0005) was maintained. The learning rate determines the magnitude of gradient descent. At high learning rates, network updates can result in great randomness. The network interacts with the data in mini-batches, i.e., it does not process an entire dataset simultaneously; rather, the data is divided into small batches. Although this hyperparameter is important in CNN models [51], it does not play an important role in our model (Figure 19). Therefore, one of the smallest values (batch size = 5) was selected to accelerate the network's training time. In many statistical models, the normalization of variables is important (e.g., to avoid the predominance of some variables due to different scales). To this end, batch normalization layers were used in the CNN model. This layer can adaptively normalize the data as the mean and variance change during training [52]. Using the hyperparameters defined above, the network's size (number of layers) was also evaluated, and better accuracy was obtained with smaller architectures (Table 10).