## 3 Problem Description and Methodology
### The Proposed Ensemble Learning Framework
#### 3.2.1 Base Module  
In our framework, the task of the base module is to utilize the training set to train the base classifiers, then, the metadata generated by these basic classifiers is used to train the metaclassifier.  
In heterogeneous stacking-based ensemble learning, selection of the base classifier is crucial to model performance because each classifier has its own advantages. It is generally believed that measuring the diversity of the underlying individual classifiers is a key factor in good integration. To obtain discriminatory metadata for classification, the base classifiers should be as diverse and as complementary as possible. The goal of this paper is to solve the spam problem detection for social networks, which is regarded as a binary classification problem. Therefore, we employ the following six different base classifiers to form the base module of our framework: The support vector machine (SVM) [38], CART [39], Gaussian Naive Bayes (GNB) [40], K-nearest neighbors (KNN) [41], random forest (RF) [42], and linear regression (LR) [43]. All these algorithms are good for solving various binary classification problems from their own point of view.  
This stacked ensemble learning approach uses the prediction results of the base classifiers as the input of the combining module. However, we cannot directly use the complete dataset to train and test the base classifiers and send the prediction results to the combining module for training. Because the potential model would have \"seen\" the test set, a risk of overfitting exists when the same data is input for prediction, which tends to have a large impact on model validation.  
The metadata generation methods of the stacking model include bootstrap, bagging, and cross-validation. As shown in Figure 2, in this study, we selected the \(K\)-fold cross-validation method.  
First, we partition the original dataset into a training set \(D_{train}\) and a test set \(D_{test}\). During the \(K\)-fold cross-validation procedure, \(D_{train}\) is split into \(K\) disjoint subsets of the same size; each subset is called a fold and maintains the same class scale as the original dataset. Each cross-validation consists of executing the training phase on \(D_{train}\) and the testing phase on \(D_{test}\). We take one classifier \(C_{n}(1,\dots,N)\) as an example, where \(N\) represents the number of base classifiers. At the training stage, we use one subset as a validation set \(D_{valid}\) and use the remaining subsets as training sets. We repeat this procedure \(K\) times, and all the prediction results on the validation sets are merged into a prediction matrix  
Figure 2: Heterogeneous stacking-based ensemble learning framework.  
\(P_{n}(n=1,\ldots,N)\). At the test stage, we apply \(C_{n}\) to generate a classification matrix. After repeating this procedure \(K\) times, we obtain \(K\) classification matrices and average them by rows to generate a matrix \(A_{n}(n=1,\ldots,N)\). The above entire procedure is repeated for the \(N\) classifiers, and all the prediction matrices \(P_{n}\) are combined into a new training set \(P\), and all the \(A_{n}\) are averaged to obtain a new test set \(A\). Through this method, the generated metadata can be guaranteed to be test results rather than results obtained by overfitting the training samples. In our method, the number of fold (\(K\)) is chosen as 10, which is considering the size of the real dataset and combined with other research experience.  
In the base module of this framework, we first train the different base classifiers to generate metadata with new features. Then, we input the resulting metadata to the combination module to train the metaclassifier.