moocore.eafdiff#

moocore.eafdiff(x, y, /, *, intervals=None, maximise=False, rectangles=False)[source]#

Compute empirical attainment function (EAF) differences.

Calculate the differences between the empirical attainment functions of two data sets.

Parameters:
  • x (ArrayLike) – Numpy matrices corresponding to the input data of left and right sides, respectively. Each data frame has at least three columns, the third one being the set of each point. See also read_datasets().

  • y (ArrayLike) – Numpy matrices corresponding to the input data of left and right sides, respectively. Each data frame has at least three columns, the third one being the set of each point. See also read_datasets().

  • intervals (int | None, default: None) – The absolute range of the differences \([0, 1]\) is partitioned into the number of intervals provided.

  • maximise (bool or list of bool) – Whether the objectives must be maximised instead of minimised. Either a single boolean value that applies to all objectives or a list of booleans, with one value per objective. Also accepts a 1D numpy array with value 0/1 for each objective.

  • rectangles (bool, default: False) – If True, the output is in the form of rectangles of the same color.

Returns:

ndarray – With rectangles=False, a matrix with three columns, The first two columns describe the points where there is a transition in the value of the EAF differences. With rectangles=True, a matrix with five columns, where the first 4 columns give the coordinates of two corners of each rectangle. In both cases, the last column gives the difference in terms of sets in x minus sets in y that attain each point (i.e., negative values are differences in favour y).

See also

moocore.read_datasets, mooplot.eafdiffplot

Examples

>>> from io import StringIO
>>> A1 = moocore.read_datasets(
...     StringIO('''
... 3 2
... 2 3
...
... 2.5 1
... 1 2
...
... 1 2''')
... )
>>> A2 = moocore.read_datasets(
...     StringIO('''
... 4 2.5
... 3 3
... 2.5 3.5
...
... 3 3
... 2.5 3.5
...
... 2 1''')
... )
>>> moocore.eafdiff(A1, A2)
array([[ 1. ,  2. ,  2. ],
       [ 2. ,  1. , -1. ],
       [ 2.5,  1. ,  0. ],
       [ 2. ,  2. ,  1. ],
       [ 2. ,  3. ,  2. ],
       [ 3. ,  2. ,  2. ],
       [ 2.5,  3.5,  0. ],
       [ 3. ,  3. ,  0. ],
       [ 4. ,  2.5,  1. ]])
>>> moocore.eafdiff(A1, A2, rectangles=True)
array([[ 2. ,  1. ,  2.5,  2. , -1. ],
       [ 1. ,  2. ,  2. ,  inf,  2. ],
       [ 2.5,  1. ,  inf,  2. ,  0. ],
       [ 2. ,  2. ,  3. ,  3. ,  1. ],
       [ 2. ,  3.5,  2.5,  inf,  2. ],
       [ 2. ,  3. ,  3. ,  3.5,  2. ],
       [ 3. ,  2.5,  4. ,  3. ,  2. ],
       [ 3. ,  2. ,  inf,  2.5,  2. ],
       [ 4. ,  2.5,  inf,  3. ,  1. ]])