RelativeHypervolume#
- class moocore.RelativeHypervolume(ref, ref_set, maximise=False)[source]#
Computes the hypervolume value of fronts relative to the hypervolume of a reference front.
The value is computed as \(1 - \frac{\text{hyp}(X)}{\text{hyp}(R)}\), where \(X\) is an input set (front), \(R\) is the reference front and \(\text{hyp}()\) is calculated by
hypervolume()
. Thus, lower values are better, in contrast to the usual hypervolume. The metric has also been called hypervolume relative deviation [1].- Parameters:
ref (
ArrayLike
) – Reference point as a 1D vector. Must be same length as a single point inref_set
.ref_set (
ArrayLike
) – Reference set (front) as 2D array. The reference front does not need to weakly dominate the input sets. If this is required, the user must ensure it.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.
References
Examples
Default is minimization, we can easily assume maximization.
>>> ref_set = [[6, 6], [2, 7], [7, 2]] >>> hv_ind = moocore.RelativeHypervolume(ref=0, ref_set=ref_set, maximise=True) >>> hv_ind([[5, 5], [4, 6], [2, 7], [7, 4]]) 0.0250000 >>> hv_ind([[5, 5], [4, 6], [7, 4]]) 0.0749999 >>> hv_ind([[0, 0]]) 1.0 >>> hv_ind(ref_set) 0.0
- __call__(data)[source]#
Compute relative hypervolume indicator as
1 - (hypervolume(data, ref=ref) / hypervolume(ref_set, ref=ref))
.- Parameters:
data (
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.- Returns:
float
– A single numerical value, the relative hypervolume indicator, which must be minimized.