This supercedes #2940.
PAVA runs in linear time, but the existing algorithm was scaling
approximately quadratically, due to the array pop in the inner loop
being O(N).
I implemented the O(N) version of PAVA using the decreasing subsequences
trick, and the performance is significantly faster in benchmarking.
The benchmarks in this diff (adapted from one of the existing unit
tests) show significant performance improvements - on the order of ~7x
faster for problems of size ~1000, ~30x faster for problems of size
10,000, and ~250x faster for problems of size 100,000.
On correctness - unit tests cover the isotonic regression code fairly
well, and all pass before and after the change. It's a fairly well known
algorithm with a bunch of implementations, so I think this is correct.
In coding up this algorithm I made some mistakes and the unit tests
caught the failures, which makes me more confident in the correctness
now. Still, the performance improvements are surprisingly high.
Added a benchmark script. For an example usage, run:
```
python benchmarks/bench_isotonic.py --iterations 10 --log_min_problem_size 2 --log_max_problem_size 8 --dataset logistic
```
When running under a tool such as @fabianp's profiler yep,
dirname(__file__) is the location of the tool's __main__.py
instead of the benchmarks directory.
Also, we shipped a tarball containing a large dataset before.
* add a title to all benchmark figures/windows
* "bench" is non-standard slang for benchmarking
* remove calls to pyplot.clf because the previous call
to pyplot.figure sets the current figure
* standardize on "Time (s)" as time axis label
* move some benchmark plot legends to the upper left corner of the plot:
most benchmarks expand from (0,0) up and to the right
* simplified plot titles and moved constant info from legend into title
* fixed typos
* made some labels more viewer-friendly
Fixes#2023.
Replaced all BSD style licenses with "BSD 3 clause"
Not checked yet!
Removed duplicate "3 clause, 3 clause"
Removed trailing period if exists
Fixed some missed licences, still about 50 to do, but those can be automated
Think I got the last of them.
Apparently me and sed have different ideas of regex.
Found a few more