## 4 Experimental Results
### Spam Detection Models and Results
In this stage, the Autoencoder model learns a compressed representation of the data by reconstructing the data. This process reduces the data's size and filters out noise while preserving the important features of the data. In the second part, shown in Figure 5b, the training and test data are encoded in the bottleneck layer using the weights of the model trained in the first part. The bottleneck layer provides representative data that is half the size of the data. These encoded data are then processed using the XGBoost model. First, the XGBoost model is trained using the encoded training dataset, and then the model's performance and success metrics are calculated with the encoded test data. The architecture of the autoencoder model consists of six dense layers supported by batch normalization and leaky ReLU activation functions. Batch normalization speeds up the training process and increases the model's generalization ability. Leaky ReLU provides a small gradient for negative values, reducing the \"dead neuron\" problem and allowing

Figure 5: Hybrid autoencoder. (**a**) Autoencoder training: reconstruction of training data with encoder and decoder. (**b**) Feature extraction and XGBoost classification: bottleneck representation with encoder, and model training and testing with XGBoost. deep networks to be trained more efficiently. The pseudo-code of the hybrid autoencoder model is presented in Algorithm 3. ```
Input: Text message \(x\), Additional statistical features \(f_{1}=0\),\(f_{2}=9\),\(f_{3}=19\) Output: Predicted message class (0 or 1) \(x^{l}\leftarrow\text{text\_preprocessing}(x)\); \(f\leftarrow\text{calculate\_statistical\_features}(x^{l}\), \(n=[0,\,9,\,19])\); \(v\leftarrow\text{CountVectorizer}(x^{l},n)\); for\(i\gets 1\) to 3 do \(e_{i}\leftarrow\text{Encoder}(v\)+\(f_{i})\); \(d\leftarrow\text{Decoder}(e_{i})\); predicted \(\leftarrow\text{MLP}(v\)+\(f_{i})\); end for for\(i\gets 1\) to 3 do \(predicted\leftarrow\text{XGBoost}(e_{i}(v\)+\(f_{i}))\);  end for
```
**Algorithm 3**Hybrid Autoencoder Model Algorithm

Ensemble learning is an approach in machine learning that combines multiple models to improve performance and generalization capability. Combining the strengths of different models reduces the error rate and provides more stable predictions. It provides an effective solution to overcome the limitations of a single model, especially on complex and variable datasets. This study combines the three models with the highest success rates, GRU39, TFMLP59, and AX40, with an ensemble learning method based on the majority voting algorithm. This approach combines the individual models' performances to achieve a higher overall success rate. The pseudo-code of the method used is presented in Algorithm 4. ```
Input: Text message \(x\)  Classification model, \(M\) (\(M_{1}=AX40\), \(M_{2}=GRU39\), \(M_{3}=TFMLP59\)),  Voting weights (\(W_{1}\), \(W_{2}\), \(W_{3}\)) Output: Predicted message class (0 or 1) \(x^{l}\leftarrow\text{text\_preprocessing}(x)\); \(f\leftarrow\text{calculate\_statistical\_features}(x^{l}\), \(n=19)\); \(p_{1}\leftarrow\text{predict classes using Model $M_{1}$ with $x^{l}$}\); \(p_{2}\leftarrow\text{predict classes using Model $M_{2}$ with $x^{l}$}\); \(p_{3}\leftarrow\text{predict classes using Model $M_{3}$ with $x^{l}$}+f\);  Calculate the final output \(E=round\)\((\sum_{i}W_{i},p_{i})\)
```

**Algorithm 4**Ensemble Learning Algorithm

The MLP, hybrid autoencoder, and GRU models we created in our study have different training and testing times. Since the training of these models was carried out in the Google Colab environment and the resource utilization in the Colab environment varies according to the intensity of the system, a healthy training and test time measurement could not be performed. Our hybrid autoencoder model generally has training times ranging from three to ten hours, while test times are much more reasonable. The hybrid autoencoder models had the highest training time.