Skip to content

Commit 2020f23

Browse files
committed
feat: Expose lowest log target chosen
Previously the log_targets function had a hard coded range factor of 10^-16 to 1. I.e. (for minimization) it chose log spaced values between min(observed) * 10^-16 and max(observed). Now one can choose the lowest target used and it defaults to 10^-8.
1 parent f39cd30 commit 2020f23

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/cocoviz/targets.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88

99

1010
def log_targets(
11-
results: ResultSet, indicator: ind.Indicator | str, number_of_targets: int = 101
11+
results: ResultSet,
12+
indicator: ind.Indicator | str,
13+
number_of_targets: int = 101,
14+
min_target: float = -8.0,
1215
) -> dict[ProblemDescription, np.ndarray]:
1316
indicator = ind.resolve(indicator)
17+
mul = np.logspace(min_target, 0, number_of_targets)
1418

1519
targets = {}
1620
for desc, problem_results in results.by_problem():
@@ -19,13 +23,12 @@ def log_targets(
1923
high = indicator_values.max()
2024
delta = high - low
2125

22-
mul = np.logspace(-16, 0, number_of_targets)
2326
if low == high:
2427
targets[desc] = np.linspace(low, high, 1)
2528
elif indicator.larger_is_better:
2629
targets[desc] = low + delta * mul
2730
else:
28-
targets[desc] = np.flip(low + delta * mul)
31+
targets[desc] = high - delta * mul
2932
return targets
3033

3134

0 commit comments

Comments
 (0)