# MLW-gcForest: A Multi-Weighted gcForest Model for Cancer Subtype Classification by Methylation Data
## 2 Materials and Methods
### gcForest Model  
The gcForest model is an ensemble approach based on decision trees [37]. This model is composed of two parts, as shown in Figure 1, of multi-grained scanning and cascade forest. (1) The multi-grained scanning structure can improve the representation learning ability of the model. This structure adopts the sliding window strategy to cut high-dimension data into multi-instance feature vectors. These feature vectors are fed into different types of random forests to obtain class vectors. Then, these class vectors are concatenated as the output of the multi-grained scanning module. (2) The second module is the cascade forest, which learns the class distribution features by assembling the numbers of the decision trees. Each layer of the cascade forest structure receives information processed by the previous layer. The output of every layer is the class vectors after the different random forest classifications, and then, these vectors are concatenated with the original vector to be input in the next cascade layer (detailed in [28]). The confidence probability vector is output by passing through each layer of the cascade forest. More distinguishing features are learned from the cascade structure, and more accurate predictions are obtained. We use k-fold cross-validation to reduce the risk of overfitting when extending a new layer. When extending a new layer, the performance of the entire cascade is estimated for the validation data. If there is no significant gain in performance, the training process is terminated. Finally, the average of each class probability is calculated from the last output of the cascade layer. We use the maximum probability value as the classification result.  
The multi-grained scanning module is shown on the left side of Figure 1. For the sequence data, we assume that the input has 400 dimensions (dim). The first sliding window has 100 dim, so a total of 301 scans are required, and 301 \(\times\) 100 feature vectors are produced. Supposing the samples have three categories, each sample is trained using a random forest [38] and a completely-random forest [39], and the class vectors (1806 dim, 2 \(\times\) 301 \(\times\) 3 dim) are generated and concatenated. Similarly, when the sliding window sizes are 200 and 300, 1206-dim (2 \(\times\) 201 \(\times\) 3 dim) and 606-dim (2 \(\times\) 101 \(\times\) 3 dim) class vectors are generated, respectively.  
The second module is the cascade forest. First, 1806-dimension class vectors are input in the cascade layer for training. After training in four forests (two random forests and two completely random forests), a 12 dim class vector (four forests, three classes) is generated. This vector is concatenated with the 1806-dim class vectors and 1818-dim vector as the input of the second layer (as shown in Figure 1). Similarly, the second-layer cascade forests output a 12-dim class vector, and then, this vector is concatenated with a 1206-dim class vector (generated by 200-dim sliding windows in the multi-grained scanning). Thus, a 1218-dim class vector is the input of the third layer. The third-layer cascade forests output a 12-dim class vector, and this vector is concatenated with a 606-dim class vector (generated by a 300-dim sliding window) as the input of the next layer. We repeat this process to generate a new layer. Whenever a new layer is generated, the overall performance of the algorithm is estimated in the validation set. If the performance does not improve, the expanding process will be terminated [28].