4

i.e., will the algorithm always return the same result (for a 1D list of numbers)? Is Fisher's Natural Breaks (the O(knlog(n)) optimization of Jenks') deterministic?

1 Answers1

5

Fisher's natural breaks uses dynamic programming to find the optimal solution and is deterministic.

There are two variants of Jenk's natural breaks.

  1. One method moves one unit from class with largest variance to that with lowest. This method does not always return the optimal answer. This is based on arbitrary initial classes so is not deterministic.
  2. An alternative method examines all partitions, this will always return the optimal answer and is deterministic.

This page provides proof about the optimality of the Fisher algorithm and notes that the basic Jenk's algorithm does not give the optimal answer:

Iteratively moving values from classes with high variation to classes with low variation is discussed on Wikipedia, which does not always result in an optimal solution.

Peter de Rivaz
  • 33,126
  • 4
  • 46
  • 75
  • Thank you!! Do you know if a Python implementation exists for Fisher's? – user8396610 Aug 09 '17 at 20:26
  • Not that I know of, but it shouldn't be too hard to convert this [C++ code](http://wiki.objectvision.nl/index.php/CalcNaturalBreaksCode) to Python - or simply embed it in a Python extension for even more speed? – Peter de Rivaz Aug 09 '17 at 20:38