A Python package for performance profiles as defined by Dolan and More.
Project description
This is a Python script for printing performance profiles as defined by E. D. Dolan and J. J. Moré.
It is based on perfprof.m
from the MATLAB Guide by D. J. Higham and N. J. Higham.
Performance profiles
Performance profiles are a mechanism to visualise the performance of multiple algorithms on multiple test problems.
Given m
problems and n
algorithms, we're interested in the relative performance of all algorithms across the entire problem set.
Let t = t(i, j) > 0
be a measure of the performance of solver j
on problem i
, where lower means "better".
Common choices for t
are:
- execution/CPU time;
- number of iterations (assuming the algorithms are iterative);
- the number of evaluations of some reference function (e.g., the ordering predicate in a sorting algorithm, or the objective function in an optimisation algorithm).
Given this data, a typical performance profile may look like this:
Each algorithm has one line plot, where a point (x, y)
means that, for x
of the problem set, the algorithm in question was within a factor of y
of the respective best algorithm.
For example:
- the point ≈
(1, 0.6)
means thatAlg2
was the fastest algorithm on around 60% of the problem set; - the point ≈
(1.5, 0.4)
means thatAlg3
was within a factor of 1.5 of the respective best algorithm for 40% of problems;- note that the "best" algorithm may be different for each problem;
- the point ≈
(1.5, 0.95)
means thatAlg1
was within a factor of 1.5 of the respective best algorithm for 95% of problems; - etc.
Generally speaking, an algorithm is considered efficient (relative to the others) when its performance profile comes close to the top left corner (1, 1)
.
It is possible for algorithms to fail on certain problems.
This can be achieved by simply setting the performance measure t(i, j)
to +inf
or NaN
.
Usage examples
import matplotlib.pyplot as plt
import perfprof
palette = ['-r', ':b', '--c', '-.g', '-y']
perfprof.perfprof(data, palette)
plt.show()
Marking y-intercepts
Markers can be inserted using the standard matplotlib
pattern.
import matplotlib.pyplot as plt
import perfprof
palette = ['o-r', 'o:b', 'o--c', 'o-.g', 'o-y']
perfprof.perfprof(data, palette, markersize=4, markevery=[0])
plt.show()
Displaying legends
Legends can be displayed using matplotlib.pyplot.legend
.
import matplotlib.pyplot as plt
import perfprof
palette = ['o-r', 'o:b', 'o--c', 'o-.g', 'o-y']
legend = ['Algorithm 1', 'Algorithm 2']
perfprof.perfprof(data, palette, markersize=4, markevery=[0])
plt.legend(legend)
plt.show()
Why another implementation?
Multiple implementations of performance profiles already exist in the public domain.
The design of perfprof
was driven by a few key desires:
- Simplicity: provide a clearly scoped, easy to use implementation that integrates with
matplotlib
; - Flexibility: unlock the full power of
matplotlib
for plot styling, legends, subplots etc.; - Robustness: the implementation must work in all edge cases including
inf
,NaN
, etc.; - Usability: full Python3 compatibility and sensible defaults where possible.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file perfprof-0.2.tar.gz
.
File metadata
- Download URL: perfprof-0.2.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d54aeca8e2646fc7c9c2be5e397de0b72bf03d449235a48afe5ee3661085cc9 |
|
MD5 | 02f510c076dadb5dd1fe150ce90d2f70 |
|
BLAKE2b-256 | 73257248b257255f30b60db4fa61c1583a470d56eecb1336546df85183b35eb1 |
File details
Details for the file perfprof-0.2-py3.8.egg
.
File metadata
- Download URL: perfprof-0.2-py3.8.egg
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f13d56fb309a63d7d1e467a40ab24c4feac062aa2bbc13d4ecb2fb9bfaf2ab7f |
|
MD5 | 175cefebed00bdee74dadfbae117ac42 |
|
BLAKE2b-256 | 08d6c373ead0d62a135d7bc9fdfc266f1f54a9c3b52cc011d00b9c17f5dfc0eb |
File details
Details for the file perfprof-0.2-py3-none-any.whl
.
File metadata
- Download URL: perfprof-0.2-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d053c52b21229014aab94ce1866dd234381e2badce45eb522ae6f81148c4b0f |
|
MD5 | e00f6abf1e5b5c5e100d0ecf63fc4930 |
|
BLAKE2b-256 | 13f02e442e4c590fcbeeb938604215090d314d9e1f34b994010775d5b44a6285 |