Skip to content

Commit

Permalink
run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
k-onoue committed Sep 27, 2024
1 parent a2ce47a commit 6922414
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(
def _lazy_init(self, search_space: dict[str, BaseDistribution]) -> None:
# Workaround for the limitation of the type of distributions
if any(
isinstance(dist, optuna.distributions.CategoricalDistribution)
isinstance(dist, optuna.distributions.CategoricalDistribution)
for dist in search_space.values()
):
raise NotImplementedError(
Expand Down Expand Up @@ -82,10 +82,12 @@ def sample_relative(
self.fitnesses = np.array(
[trial.value for trial in completed_trials[-self.population_size :]]
)
self.fitnesses = np.array([
trial.value if study.direction == StudyDirection.MINIMIZE else -trial.value
for trial in completed_trials[-self.population_size :]
])
self.fitnesses = np.array(
[
(trial.value if study.direction == StudyDirection.MINIMIZE else -trial.value)
for trial in completed_trials[-self.population_size :]
]
)

# Update leaders (alpha, beta, gamma, ...)
sorted_indices = np.argsort(self.fitnesses)
Expand Down

0 comments on commit 6922414

Please sign in to comment.