hv_contributions#
- moocore.hv_contributions(x, /, ref, maximise=False)[source]#
Hypervolume contributions of a set of points.
Computes the hypervolume contribution of each point of a set of points with respect to a given reference point. The hypervolume contribution of point \(\vec{p} \in X\) is \(\text{hvc}(\vec{p}) = \text{hyp}(X) - \text{hyp}(X \setminus \{\vec{p}\})\). Dominated points have zero contribution. Duplicated points have zero contribution even if not dominated, because removing one of the duplicates does not change the hypervolume of the remaining set.
The current implementation uses the naive algorithm that requires calculating the hypervolume \(|X|+1\) times.
See also
For details about the hypervolume, see Hypervolume metric.
- Parameters:
x (
ArrayLike
) – Numpy array of numerical values, where each row gives the coordinates of a point. If the array is created from theread_datasets()
function, remove the last column.ref (
ArrayLike
) – Reference point as a 1D vector. Must be same length as a single point inx
.maximise (
bool
|list
[bool
], default:False
) – 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
- Returns:
array
– An array of floating-point values as long as the number of rows inx
. Each value is the contribution of the corresponding point inx
.
Examples
>>> dat = np.array([[5, 5], [4, 6], [2, 7], [7, 4]]) >>> moocore.hv_contributions(dat, ref=[10, 10]) array([2., 1., 6., 3.])