Adaptive kNN using Expected Accuracy for Classification of Geo-Spatial Data

Mark Kibanov, Martin Becker, Juergen Mueller, Martin Atzmueller, Andreas Hotho, Gerd StummearXiv 2017 · DOI

TL;DR

ACKER (Adaptive Classifier based on kNN Expected accuRacy) is a novel algorithm that dynamically selects the optimal number of neighbors ($k$) for every individual data point. By maximizing "expected accuracy" based on structurally similar observations in the training set, ACKER significantly outperforms standard kNN and existing adaptive methods on complex geo-spatial datasets.

What Problem Does This Paper Address?

The $k$-Nearest Neighbor (kNN) algorithm is a staple of machine learning due to its simplicity and interpretability. However, its biggest weakness is the "global $k$"—the requirement to use the same number of neighbors for every classification task across a dataset.

In real-world geo-spatial data, points are rarely distributed evenly. As shown in Figure 1, some areas have dense clusters of data while others are extremely sparse.

Figure 1: Examples of different distributions of data points in the WideNoise Dataset. Different colors denote different noise levels.

A small $k$ in a sparse area might lead to noisy, unreliable classifications. Conversely, a large $k$ in a dense area might pull in "neighbors" that are geographically close but belong to entirely different clusters, diluting the local signal. The authors aim to bridge this gap by allowing the algorithm to "sense" the local data environment and adjust $k$ on the fly.

Methods

The authors introduce ACKER. The core innovation is the concept of Expected Accuracy.

Instead of just looking at the $k$ neighbors of a new point $p$, ACKER performs a "meta-check":

  1. Find Similar Environments: It searches the training data for $l$ points that have a "structurally similar" neighborhood to point $p$.
  2. Test Candidate $k$ Values: For each candidate $k$ (e.g., $k=1$ to 200), it calculates how accurately those similar training points would have been classified.
  3. Maximize Accuracy: It selects the $k$ that yielded the highest accuracy among those similar training points and applies that specific $k$ to classify point $p$.

To define what makes a neighborhood "similar," the authors tested several functions:

  • avg_dist: The average distance to the $k$ nearest neighbors.
  • max_dist: The distance to the $k$-th neighbor (a proxy for local density).
  • max_avg_comb: A combination of both.
  • lat_lon: Simple geographic proximity (used as a baseline).

Datasets

The researchers evaluated ACKER using five classification tasks derived from three distinct geo-spatial datasets:

  • Milan Twitter Dataset: Predicting which local landmarks (e.g., Milan Cathedral) are mentioned in tweets based on GPS coordinates.
  • WideNoise Dataset: Predicting noise pollution levels (3 or 6 classes) based on worldwide mobile app measurements.
  • San Francisco Crimes Dataset: Predicting the category of a crime (16 classes) based on its location. This dataset was specifically chosen for its highly skewed class distribution, as seen in Figure 2.
Figure 2: Frequency of different crimes in crimessf classifi- cation task.

Key Insights and Ideas

  • Structural Similarity Trumps Proximity: For most tasks, choosing $k$ based on density features (avg_dist or max_dist) worked better than just looking at the nearest geographic neighbors (lat_lon). This suggests that the "shape" of the data distribution is more informative for tuning kNN than simple location.
  • Expected Accuracy is a Reliable Proxy: The authors found a high correlation between their "expected accuracy" metric and the actual performance of the classifier (see Figure 3). This validates the core logic of the ACKER algorithm.
  • The "Elbow Rule" for Speed: You don't need to search a massive range of $k$. The authors demonstrated that accuracy typically plateaus or even drops after $k=50$. By capping the search range, they could speed up the algorithm by 4x without sacrificing performance.
  • Skewed Data is the Final Boss: ACKER struggled to show significant gains on the SF Crimes dataset. The authors attribute this to the extreme class imbalance, where the majority class ("Larceny/Theft") tends to overwhelm local neighborhood signals regardless of the $k$ chosen.
Figure 3: Correlation between real and expected accuracy dependent on value of l.

Key Results

  • Accuracy Boost: On the twitter11 task, ACKER achieved 82.5% accuracy, compared to 77.3% for the best possible standard kNN.
  • Baseline Comparison: ACKER consistently outperformed previously proposed adaptive kNN methods that relied solely on spatial proximity.
  • Reliability: The expected accuracy measure reached an ROC AUC of over 0.9 for some tasks, meaning the algorithm is very good at "knowing when it knows" the correct classification.

Limitations and Future Work

The primary limitation is the computational overhead of searching for similar environments for every point, though the authors suggest indexing techniques (like B+ trees or kd-trees) to mitigate this.

Future research directions include:

  • Testing ACKER on high-dimensional, non-geo-spatial data to see if the density-based adaptive logic holds up.
  • Developing more formal, automated ways to choose the input parameters $l$ (number of similar points to check) and the range of $k$.
  • Investigating how to handle skewed class distributions more effectively within the adaptive framework.

Summary updated

BibTeX
@misc{kibanov2017adaptive,
  author = {Mark Kibanov and Martin Becker and Juergen Mueller and Martin Atzmueller and Andreas Hotho and Gerd Stumme},
  title = {{Adaptive kNN using Expected Accuracy for Classification of Geo-Spatial Data}},
  year = {2017},
  eprint = {1801.01453},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1801.01453},
}
Figure