Abstract
As an improved method of k-nearest neighbor classification, the local mean-based nonparametric classifier had the ability to resist the effects of noise and classify unbalanced data. When selecting the nearest k samples and calculating the distance between the test samples and the local mean-based vectors, it always used Euclidean distance. However, for multi-dimensional data, using Euclidean distance which focused on the difference of the value to determine whether two vectors was similar was not so accurate. To solve this problem, a new local mean-based nonparametric classification method was proposed in this paper. It used the cosine distance which focused more on the difference of the dimension to select the k nearest neighbors and compute the distance between the test samples and the local mean-based vectors. The new local mean-based nonparametric classification method was tested on the UCI datasets: Iris and Wine for different values of k in different test data set, the simulation results show that it outperforms the existing local mean-based nonparametric classifier.
Introduction
The k-Nearest Neighbor (k-NN) algorithm is a fundamental tool in machine learning due to its simplicity and lack of a training phase. Despite its popularity, k-NN faces significant challenges: sensitivity to data distribution (unbalanced classes) and the difficulty of selecting an optimal number of neighbors ($k$). While improvements like the Local Mean-based Classifier (LMC) address these by using class-specific "geometric centers," they typically rely on Euclidean distance. In high-dimensional spaces, Euclidean distance is often sensitive to noise and focuses on absolute magnitudes rather than the directional relationships between features, which can lead to suboptimal classification.
Methodology: The N-LMC Algorithm
The proposed New Local Mean-based Nonparametric Classification (N-LMC) method integrates cosine distance into the LMC framework to enhance robustness in multidimensional data.
The N-LMC algorithm proceeds through four primary steps:
- Neighbor Selection: For a given test sample $x$, the $k$ nearest neighbors within each class are identified using cosine distance.
- Local Mean Calculation: A "local mean vector" is computed for each class by averaging its $k$ neighbors, representing the class's local center of gravity.
- Similarity Measurement: The cosine distance is calculated between the test sample $x$ and each class's local mean vector.
- Classification: The sample is assigned to the class whose local mean vector exhibits the highest cosine similarity (smallest angle).
By prioritizing the direction of feature vectors over their absolute spatial positions, N-LMC provides a more reliable similarity measure for complex datasets.
Experimental Results and Discussion
The N-LMC method was evaluated against standard k-NN and the Euclidean-based LMC using the Iris and Wine datasets from the UCI Machine Learning Repository.
Key Findings
- Superior Performance in High Dimensions: On the Wine dataset (13 features), N-LMC showed a marked improvement over baseline methods. The shift to cosine distance allowed for clearer class separation in this higher-dimensional space.
- Enhanced Stability: N-LMC produced smoother accuracy curves as $k$ varied. Unlike standard k-NN, which can be highly sensitive to the choice of $k$, N-LMC remained stable, reducing the risk associated with parameter selection.
- Robustness to Unbalanced Data: By calculating local means independently for each class, N-LMC prevents majority classes from dominating the classification process, a common issue in standard k-NN.
Conclusion
N-LMC offers a significant advancement over traditional local mean-based classifiers by leveraging cosine distance to capture directional similarities in multidimensional data. While the results are promising, future work should address the computational overhead of calculating local means for large numbers of classes and evaluate the method's performance in extremely high-dimensional scenarios. Additionally, hybrid metrics combining magnitude and direction could be explored to further refine classification accuracy.
Summary updated