Skip to content

Commit

Permalink
Undo unnecessary lazy imports
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianSosic committed Apr 3, 2024
1 parent 7ce820f commit abdfe38
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions baybe/objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from baybe.serialization import SerialMixin
from baybe.targets.base import Target
from baybe.utils.numerical import geom_mean

if TYPE_CHECKING:
from baybe.targets.numerical import NumericalTarget
Expand Down Expand Up @@ -134,8 +135,6 @@ def transform(self, data: pd.DataFrame) -> pd.DataFrame:
Raises:
ValueError: If the specified averaging function is unknown.
"""
from baybe.utils.numerical import geom_mean

# Perform transformations that are required independent of the mode
transformed = data[[t.name for t in self.targets]].copy()
for target in self.targets:
Expand Down
3 changes: 1 addition & 2 deletions baybe/parameters/numerical.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from baybe.parameters.base import ContinuousParameter, DiscreteParameter
from baybe.parameters.validation import validate_is_finite, validate_unique_values
from baybe.utils.interval import InfiniteIntervalError, Interval, convert_bounds
from baybe.utils.numerical import DTypeFloatNumpy


@define(frozen=True, slots=False)
Expand Down Expand Up @@ -56,8 +57,6 @@ def _validate_tolerance( # noqa: DOC101, DOC103
Raises:
ValueError: If the tolerance is not safe.
"""
from baybe.utils.numerical import DTypeFloatNumpy

# For zero tolerance, the only left requirement is that all parameter values
# are distinct, which is already ensured by the corresponding validator.
if tolerance == 0.0:
Expand Down
3 changes: 1 addition & 2 deletions baybe/utils/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from packaging import version

from baybe.serialization import SerialMixin, converter
from baybe.utils.numerical import DTypeFloatNumpy

if TYPE_CHECKING:
from torch import Tensor
Expand Down Expand Up @@ -125,8 +126,6 @@ def to_tuple(self) -> tuple[float, float]:

def to_ndarray(self) -> np.ndarray:
"""Transform the interval to a :class:`numpy.ndarray`."""
from baybe.utils.numerical import DTypeFloatNumpy

return np.array([self.lower, self.upper], dtype=DTypeFloatNumpy)

def to_tensor(self) -> "Tensor":
Expand Down

0 comments on commit abdfe38

Please sign in to comment.