For generating empirical cumulative distribution function figures.

The outputs show empirical cumulative distribution functions (ECDFs) of
the running times of trials. These ECDFs show on the y-axis the fraction
of cases for which the running time (left subplots) or the df-value
(right subplots) was smaller than the value given on the x-axis. On the
left, ECDFs of the running times from trials are shown for different
target values. Light brown lines in the background show ECDFs for target
value 1e-8 of all algorithms benchmarked during BBOB-2009. On the right,
ECDFs of df-values from all trials are shown for different numbers of
function evaluations.

**Example**

.. plot::
   :width: 75%

   import urllib
   import tarfile
   import glob
   from pylab import *
   import cocopp

   # Collect and unarchive data (3.4MB)
   dataurl = 'http://coco.lri.fr/BBOB2009/pythondata/BIPOP-CMA-ES.tar.gz'
   filename, headers = urllib.urlretrieve(dataurl)
   archivefile = tarfile.open(filename)
   archivefile.extractall()

   # Empirical cumulative distribution function figure
   ds = cocopp.load(glob.glob('BBOB2009pythondata/BIPOP-CMA-ES/ppdata_f0*_20.pickle'))
   figure()
   cocopp.pprldistr.plot(ds)
   cocopp.pprldistr.beautify() # resize the window to view whole figure

CAVEAT: the naming conventions in this module mix up ART (an estimate
of the expected running length) and run lengths.
Function load_previous_data Undocumented
Function load_previous_RLBdata Undocumented
Function caption_single Undocumented
Function caption_two Undocumented
Function beautifyECDF Generic formatting of ECDF figures.
Function beautifyRLD Format and save the figure of the run length distribution.
Function beautifyFVD Formats the figure of the run length distribution.
Function plotECDF Plot an empirical cumulative distribution function.
Function erld_data return [sorted_runlengths_divided_by_dimension, nb_of_all_runs, functions_ids_found, functions_ids_solved]
Function plotRLDistr Creates run length distributions from a sequence dataSetList.
Function plotFVDistr Creates ECDF of final function values plot from a DataSetList.
Function comp Generate figures of ECDF that compare 2 algorithms.
Function beautify Format the figure of the run length distribution.
Function plot Plot ECDF of evaluations and final function values in a single figure for demonstration purposes.
Function plot_previous_algorithms Display BBOB 2009 data, by default from pprldistr.previous_data_filename = 'pprldistr2009_1e-8.pickle.gz'
Function plotRLB_previous_algorithms Display BBOB 2009 data, by default from pprldistr.previous_data_filename = 'pprldistr2009_1e-8.pickle.gz'
Function main Generate figures of empirical cumulative distribution functions.
Function _plotRLDistr_old Creates run length distributions from a sequence dataSetList.
def load_previous_data(filename=previous_data_filename, force=False):
Undocumented
def load_previous_RLBdata(filename=previous_RLBdata_filename):
Undocumented
def caption_single():
Undocumented
def caption_two():
Undocumented
def beautifyECDF():
Generic formatting of ECDF figures.
def beautifyRLD(xlimit_max=None):

Format and save the figure of the run length distribution.

After calling this function, changing the boundaries of the figure will not update the ticks and tick labels.

def beautifyFVD(isStoringXMax=False, ylabel=True):
Formats the figure of the run length distribution.

This function is to be used with :py:func:`plotFVDistr`

:param bool isStoringMaxF: if set to True, the first call
                           :py:func:`beautifyFVD` sets the global
                           :py:data:`fmax` and all subsequent call
                           will have the same maximum xlim
:param bool ylabel: if True, y-axis will be labelled.
def plotECDF(x, n=None, **plotArgs):
Plot an empirical cumulative distribution function.
Parametersseq xdata
int nnumber of samples, if not provided len(x) is used
plotArgsoptional keyword arguments provided to plot.
Returnshandles of the plot elements.
def _plotRLDistr_old(dsList, target, **plotArgs):

Creates run length distributions from a sequence dataSetList.

Labels of the line (for the legend) will be set automatically with the following format: %+d: %d/%d % (log10()

ParametersDataSetList dsListInput data sets
dict or float targettarget precision
plotArgsadditional arguments passed to the plot command
Returnshandles of the resulting plot.
def erld_data(dsList, target, max_fun_evals=np.inf):

return [sorted_runlengths_divided_by_dimension, nb_of_all_runs, functions_ids_found, functions_ids_solved]

max_fun_evals is only used to compute function_ids_solved, that is elements in sorted_runlengths... can be larger.

copy-paste from plotRLDistr and not used.

def plotRLDistr(dsList, target, label='', max_fun_evals=np.inf, **plotArgs):
Creates run length distributions from a sequence dataSetList.

Labels of the line (for the legend) will be appended with the number
of functions at least solved once.

:param DataSetList dsList: Input data sets
:param target: a method that delivers single target values like ``target((fun, dim))``
:param str label: target value label to be displayed in the legend
:param max_fun_evals: only used to determine success on a single function
:param plotArgs: additional arguments passed to the plot command

:returns: handles of the resulting plot.

Example::

    plotRLDistr(dsl, lambda f: 1e-6)

Details: ``target`` is a function taking a (function_number, dimension) pair
as input and returning a ``float``. It can be defined as
``lambda fun_dim: targets(fun_dim)[j]`` returning the j-th element of
``targets(fun_dim)``, where ``targets`` is an instance of
``class pproc.TargetValues`` (see the ``pproc.TargetValues.__call__`` method).

TODO: data generation and plotting should be in separate methods
TODO: different number of runs/data biases the results, shouldn't
      the number of data made the same, in case?
def plotFVDistr(dsList, budget, min_f=None, **plotArgs):
Creates ECDF of final function values plot from a DataSetList.
ParametersdsListdata sets
min_fused for the left limit of the plot
float budgetmaximum evaluations / dimension that "count"
plotArgsadditional arguments passed to plot
Returnshandle
def comp(dsList0, dsList1, targets, isStoringXMax=False, outputdir='', info='default'):
Generate figures of ECDF that compare 2 algorithms.

:param DataSetList dsList0: list of DataSet instances for ALG0
:param DataSetList dsList1: list of DataSet instances for ALG1
:param seq targets: target function values to be displayed
:param bool isStoringXMax: if set to True, the first call
                           :py:func:`beautifyFVD` sets the globals
                           :py:data:`fmax` and :py:data:`maxEvals`
                           and all subsequent calls will use these
                           values as rightmost xlim in the generated
                           figures.
:param string outputdir: output directory (must exist)
:param string info: string suffix for output file names.
def beautify():

Format the figure of the run length distribution.

Used in conjunction with plot method (obsolete/outdated, see functions beautifyFVD and beautifyRLD).

def plot(dsList, targets=None, **plotArgs):
Plot ECDF of evaluations and final function values in a single figure for demonstration purposes.
def plot_previous_algorithms(dim, funcs):
Display BBOB 2009 data, by default from pprldistr.previous_data_filename = 'pprldistr2009_1e-8.pickle.gz'
def plotRLB_previous_algorithms(dim, funcs):
Display BBOB 2009 data, by default from pprldistr.previous_data_filename = 'pprldistr2009_1e-8.pickle.gz'
def main(dsList, isStoringXMax=False, outputdir='', info='default'):
Generate figures of empirical cumulative distribution functions.

This method has a feature which allows to keep the same boundaries
for the x-axis, if ``isStoringXMax==True``. This makes sense when
dealing with different functions or subsets of functions for one
given dimension.

CAVE: this is bug-prone, as some data depend on the maximum
evaluations and the appearence therefore depends on the
calling order.

:param DataSetList dsList: list of DataSet instances to process.
:param bool isStoringXMax: if set to True, the first call
                           :py:func:`beautifyFVD` sets the
                           globals :py:data:`fmax` and
                           :py:data:`maxEvals` and all subsequent
                           calls will use these values as rightmost
                           xlim in the generated figures.
:param string outputdir: output directory (must exist)
:param string info: string suffix for output file names.
API Documentation for cocopp, generated by pydoctor at 2020-01-21 16:27:37.