# Stacked Ensembles Powering Smart Farming for Imbalanced Sugarcane Disease Detection
## 2 Methodology
### Exploratory Data Analysis (EDA)  
Figure 3 illustrates the exploratory analysis of the different class distributions, as shown in subplot (a). The frequency distribution of the imbalanced class of brown spot dominates the dataset, while brown rust, pokkah boeng, and smut are underrepresented. While this figure focuses on the imbalanced distribution of infected samples, it is important to highlight that the dataset also includes healthy and dried leaves as part of the classification process. These two classes are used in the multi-class classification experiments. This ensures a robust comparison between diseased and non-diseased classes, improving the model's ability to generalize. Subplot (b) illustrates the height attribute across different disease classes. Sett rot and brown rust show a thinner distribution, whereas all other classes exhibit broader ones, indicating that the height might be a useful feature in differentiating between some disease classes. Subplot (c) depicts the size distribution across the disease classes, showing that features like the size vary significantly between the categories. For instance, smut shows a wider distribution, while viral diseases with larger frequencies are concentrated around smaller values. This suggests that the size could also be an important distinguishing feature. Finally, subplot (d) presents the distribution of the aggregation metric across the classes. Most classes overlap significantly in this metric, reducing its effectiveness as a discriminative feature without further transformations or feature engineering. t-SNE is applied here to visually understand the embedded feature space derived from the embeddings. This starts with normalizing the features and applying principal component analysis (PCA) reduction to 10 components. The cosine distance metric is used here with perplexity of 50 to initialize the t-SNE. These choices provide a balance between local and global structure preservation, ensuring that smaller groups are well clustered while maintaining a meaningful global arrangement. The cosine distance metric is better in capturing the similarities in high-dimensional spaces, particularly when dealing with feature vectors extracted from deep networks. The PCA initialization stabilizes the optimization process and prevents t-SNE from becoming stuck in local minima. Figure 2: Flowchart of stacking classification pipeline. These parameters are suitable for capturing non-linear patterns in high-dimensional data. Instead of prioritizing the preservation of global variance as in PCA, t-SNE focuses on local structures, which makes it more effective in identifying clusters and non-linear relationships in high-dimensional feature embeddings. By comparing t-SNE to clustering algorithms such as K-Means or DBSCAN, we can see that t-SNE provides a smooth, continuous representation, revealing natural separations in the data, rather than enforcing predefined cluster boundaries. This makes it particularly useful for deep learning embeddings, where class relationships are often complex and non-linear. Figure 4 (left side, colored) illustrates the disease categories in the reduced 2D space. Clusters corresponding to distinct diseases, such as pokkah boeng, sett rot, and viral diseases, seem to be well separated, indicating that the extracted features successfully capture the inter-class differences for these diseases. However, some overlap is observed among classes such as banded chlorosis, yellow leaf, and brown spot, which may suggest shared visual or structural characteristics in the input data. Figure 4 (right side, blue and green) visualizes the different clusters based on the embedded feature size feature. We notice clear intra-class differences for the diseases. Variations in the dataset, providing a qualitative understanding of the feature space, are shown in this part. Figure 3: Exploratory analysis of class distributions and feature variability. (**a**) Frequency distribution of imbalanced classes. (**b**) Height distribution across disease classes (measured in mm).