Skip to content

Commit

Permalink
Simplify syntax with 'prod'
Browse files Browse the repository at this point in the history
  • Loading branch information
Waschenbacher committed Jul 11, 2024
1 parent 5d847ea commit 153e25b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions baybe/searchspace/continuous.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from __future__ import annotations

import math
import warnings
from collections.abc import Collection, Iterable, Sequence
from functools import reduce
from itertools import chain, product
from typing import TYPE_CHECKING, Any, cast

Expand Down Expand Up @@ -122,13 +122,11 @@ def n_combinatorial_inactive_parameters(self) -> int:
if not self.constraints_cardinality:
return 0

return reduce(
lambda x, y: x * y,
[
con.n_combinatorial_inactive_parameters
for con in self.constraints_cardinality
],
)
n_combinatorial_inactive_params = [
con.n_combinatorial_inactive_parameters
for con in self.constraints_cardinality
]
return math.prod(n_combinatorial_inactive_params)

@property
def combinatorial_inactive_parameters(
Expand Down

0 comments on commit 153e25b

Please sign in to comment.