An incremental linear-time learning algorithm for the Optimum-Path Forest classifier

Moacir Ponti, Mateus RivaInf. Process. Lett 2017

Introduction

The Optimum-Path Forest (OPF) classifier is a robust, parameter-independent machine learning tool that models datasets as graphs where nodes represent instances and edges represent distances. Despite its effectiveness, its traditional training complexity is $O(n^2)$, making it computationally expensive for large-scale or streaming data. This paper introduces OPFI (OPF-Incremental), an algorithm designed to incorporate new data points in linear time ($O(n)$), enabling real-time updates without the need for full retraining.

The OPFI Algorithm

The core innovation of OPFI lies in treating the addition of a new instance as a local graph update rather than a global recalculation. Instead of rebuilding the entire optimum-path forest, the algorithm identifies the "predecessor" of the new node (the node that "conquered" it) and performs a localized adjustment.

As illustrated in Figure 1, the insertion process handles three primary scenarios based on the relationship between the new instance and its predecessor:

  1. Same Class, Non-Prototype: The new instance is integrated into the existing tree structure using an $O(n)$ Minimum Spanning Tree (MST) update.
  2. Same Class, Prototype: If the new instance is a better candidate for a prototype than the current one, it triggers a local "reconquest" of its subtree.
  3. Different Class: To maintain model integrity when a potential boundary shift or new cluster is detected, both the new instance and its predecessor are designated as prototypes, effectively splitting or creating new trees.

By utilizing an efficient MST insertion function and a targeted reconquest mechanism, OPFI ensures the graph remains an optimum-path forest while avoiding the $O(n^2)$ cost of global recalculation. Unlike previous incremental approaches like DIFT, which often degrade into simple 1-Nearest Neighbor classifiers by over-generating prototypes, OPFI preserves the structural integrity of the forest.

Experimental Evaluation

The authors evaluated OPFI across 15 diverse datasets to test its versatility:

  • Synthetic distributions: Base1-3, Lithuanian, Circle-vs-Gaussian, Cone-Torus, and Saturn, used to test geometric class distributions.
  • Real-world applications: Medical data (Cardiotocography, Parkinsons), industrial security (Energy profiles, SpamBase), and Computer Vision (MPEG7-B, Produce image dataset).
  • Large-scale data: The Skin segmentation dataset, containing over 245,000 examples, served as a benchmark for computational efficiency.

Results and Discussion

The experiments yielded two critical findings:

  • Accuracy Parity: In almost all cases, OPFI achieved balanced accuracies nearly identical to the original quadratic OPF. For instance, on the massive "Skin" dataset, both models reached an impressive 99.9% accuracy.
  • Linear Scaling: While the original OPF's training time grows quadratically, OPFI maintains a steady linear slope as iterations increase. This efficiency allows the classifier to scale to datasets that were previously computationally inaccessible.

Furthermore, by prioritizing the label of the newly inserted instance, OPFI ensures that the model adapts immediately to new information. This "label integrity" is crucial for detecting shifting distributions in real-time environments.

Conclusion

OPFI transforms the Optimum-Path Forest into a viable tool for modern, high-velocity data environments. By reducing update complexity from $O(n^2)$ to $O(n)$, it opens new possibilities for Data Stream Mining and Active Learning, where models must continuously evolve as new information arrives. While the internal graph structures of OPFI may differ slightly from a model trained from scratch, the performance benefits make it a powerful alternative for evolving datasets.

Summary updated

BibTeX
@article{ponti2017incremental,
  author = {Moacir Ponti and Mateus Riva},
  title = {{An incremental linear-time learning algorithm for the Optimum-Path Forest classifier}},
  journal = {Inf. Process. Lett},
  year = {2017},
  doi = {10.1016/j.ipl.2017.05.004},
}
Figure