Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 0411cdc

Browse files
author
damart
committed
Added some doctrings
1 parent 829ad01 commit 0411cdc

File tree

4 files changed

+165
-913
lines changed

4 files changed

+165
-913
lines changed

bluepyopt/deapext/hype.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import numpy
22

3-
def hypesub(l, A, actDim, bounds, pvec, alpha, k):
4-
3+
def hypesub_(l, A, actDim, bounds, pvec, alpha, k):
54
h = numpy.zeros(l)
65
i = numpy.argsort(A[:, actDim - 1])
76
S = A[i]
@@ -27,12 +26,15 @@ def hypesub(l, A, actDim, bounds, pvec, alpha, k):
2726

2827

2928
def hypeIndicatorExact(points, bounds, k):
30-
"""
31-
points: objectives (to be minimized),
32-
bounds: reference point,
33-
k: parameter of HypE
34-
35-
Example: scores = hypeIndicatorExact([[1., 3.], [3., 1.]], [4., 4.], 1)
29+
"""HypE algorithm. Python implementation of the Matlab code available at
30+
https://sop.tik.ee.ethz.ch/download/supplementary/hype/
31+
32+
Args:
33+
points(array): 2D array containing the objective values of the
34+
population
35+
bounds(array): 1D array containing the reference point from which to
36+
compute the hyper-volume
37+
k(int): HypE parameter
3638
"""
3739

3840
Ps = points.shape[0]
@@ -47,10 +49,23 @@ def hypeIndicatorExact(points, bounds, k):
4749
alpha.append(numpy.prod((k - j) / (Ps - j) / i))
4850
alpha = numpy.asarray(alpha)
4951

50-
return hypesub(points.shape[0], points, actDim, bounds, pvec, alpha, k)
52+
return hypesub_(points.shape[0], points, actDim, bounds, pvec, alpha, k)
5153

5254

5355
def hypeIndicatorSampled(points, bounds, k, nrOfSamples):
56+
"""Monte-Carlo approximation of the HypE algorithm. Python implementation
57+
of the Matlab code available at
58+
https://sop.tik.ee.ethz.ch/download/supplementary/hype/
59+
60+
Args:
61+
points(array): 2D array containing the objective values of the
62+
population
63+
bounds(array): 1D array containing the reference point from which to
64+
compute the hyper-volume
65+
k(int): HypE parameter
66+
nrOfSamples(int): number of random samples to use for the
67+
Monte-Carlo approximation
68+
"""
5469

5570
nrP = points.shape[0]
5671
dim = points.shape[1]

bluepyopt/deapext/optimisationsCMA.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(self,
7373
algorithm, possible values are 'single_objective' or
7474
'multi_objective'
7575
weight_hv (float): between 0 and 1. Weight given to the
76-
hypervolume contribution when computing the score of an
76+
hyper-volume contribution when computing the score of an
7777
individual in MO-CMA. The weight of the fitness contribution
7878
is computed as 1 - weight_hv.
7979
fitness_reduce (fcn): function used to reduce the objective values

0 commit comments

Comments
 (0)