Skip to content

Commit

Permalink
Relocate priors (#238)
Browse files Browse the repository at this point in the history
This PR moves our priors from `baybe.kernels.priors` to `baybe.priors`
since they can be used in general non-kernel contexts, for instance, as
in #231.
  • Loading branch information
AdrianSosic authored May 14, 2024
2 parents 09243ce + 7d31c4d commit 24bd1c1
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion baybe/kernels/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from attrs import define

from baybe.kernels.priors.base import Prior
from baybe.priors.base import Prior
from baybe.serialization.core import (
converter,
get_base_structure_hook,
Expand Down
2 changes: 1 addition & 1 deletion baybe/kernels/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from attrs.validators import optional as optional_v

from baybe.kernels.base import Kernel
from baybe.kernels.priors.base import Prior
from baybe.priors.base import Prior
from baybe.utils.conversion import fraction_to_float
from baybe.utils.validation import finite_float

Expand Down
4 changes: 2 additions & 2 deletions baybe/kernels/priors/__init__.py → baybe/priors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Available priors."""
"""Prior distributions."""

from baybe.kernels.priors.basic import (
from baybe.priors.basic import (
GammaPrior,
HalfCauchyPrior,
HalfNormalPrior,
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions baybe/kernels/priors/basic.py → baybe/priors/basic.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Priors that can be used for kernels."""
"""A collection of common prior distributions."""

from typing import Any

from attrs import define, field
from attrs.validators import gt

from baybe.kernels.priors.base import Prior
from baybe.priors.base import Prior
from baybe.utils.validation import finite_float


Expand Down
2 changes: 1 addition & 1 deletion baybe/surrogates/gaussian_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from baybe.kernels import MaternKernel, ScaleKernel
from baybe.kernels.base import Kernel
from baybe.kernels.priors import GammaPrior
from baybe.priors import GammaPrior
from baybe.searchspace import SearchSpace
from baybe.surrogates.base import Surrogate

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
)
from baybe.exceptions import OptionalImportError
from baybe.kernels import MaternKernel
from baybe.kernels.priors import GammaPrior
from baybe.objectives.desirability import DesirabilityObjective
from baybe.objectives.single import SingleTargetObjective
from baybe.parameters import (
Expand All @@ -39,6 +38,7 @@
SubstanceEncoding,
TaskParameter,
)
from baybe.priors import GammaPrior
from baybe.recommenders.meta.base import MetaRecommender
from baybe.recommenders.meta.sequential import (
SequentialMetaRecommender,
Expand Down
2 changes: 1 addition & 1 deletion tests/hypothesis_strategies/priors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import hypothesis.strategies as st

from baybe.kernels.priors import (
from baybe.priors import (
GammaPrior,
HalfCauchyPrior,
HalfNormalPrior,
Expand Down
2 changes: 1 addition & 1 deletion tests/serialization/test_prior_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from hypothesis import given

from baybe.kernels.priors.base import Prior
from baybe.priors.base import Prior
from tests.hypothesis_strategies.priors import priors


Expand Down
2 changes: 1 addition & 1 deletion tests/test_iterations.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from baybe.acquisition.base import AcquisitionFunction
from baybe.kernels import MaternKernel, ScaleKernel
from baybe.kernels.priors import (
from baybe.priors import (
GammaPrior,
HalfCauchyPrior,
HalfNormalPrior,
Expand Down

0 comments on commit 24bd1c1

Please sign in to comment.