From 7effeeb86b29951f42d56b92ea0fea0a45262226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20P=2E=20D=C3=BCrholt?= Date: Wed, 6 Nov 2024 15:29:42 +0100 Subject: [PATCH 1/3] fix linting --- bofire/data_models/surrogates/shape.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bofire/data_models/surrogates/shape.py b/bofire/data_models/surrogates/shape.py index 5ce9d64f8..b6cf27ac1 100644 --- a/bofire/data_models/surrogates/shape.py +++ b/bofire/data_models/surrogates/shape.py @@ -31,9 +31,9 @@ class PiecewiseLinearGPSurrogateHyperconfig(Hyperconfig): - type: Literal[ + type: Literal["PiecewiseLinearGPSurrogateHyperconfig"] = ( # type: ignore "PiecewiseLinearGPSurrogateHyperconfig" - ] = "PiecewiseLinearGPSurrogateHyperconfig" + ) inputs: Inputs = Inputs( features=[ CategoricalInput( @@ -44,9 +44,9 @@ class PiecewiseLinearGPSurrogateHyperconfig(Hyperconfig): ] ) target_metric: RegressionMetricsEnum = RegressionMetricsEnum.MAE - hyperstrategy: Literal[ - "FactorialStrategy", "SoboStrategy", "RandomStrategy" - ] = "FactorialStrategy" + hyperstrategy: Literal["FactorialStrategy", "SoboStrategy", "RandomStrategy"] = ( + "FactorialStrategy" + ) @staticmethod def _update_hyperparameters( @@ -112,7 +112,7 @@ class PiecewiseLinearGPSurrogate(TrainableBotorchSurrogate): hyperconfig: The hyperconfig that is used for training the GP. """ - type: Literal["PiecewiseLinearGPSurrogate"] = "PiecewiseLinearGPSurrogate" + type: Literal["PiecewiseLinearGPSurrogate"] = "PiecewiseLinearGPSurrogate" # type: ignore interpolation_range: Bounds n_interpolation_points: PositiveInt = 1000 x_keys: list[str] @@ -122,7 +122,7 @@ class PiecewiseLinearGPSurrogate(TrainableBotorchSurrogate): append_x: Annotated[List[float], AfterValidator(validate_monotonically_increasing)] prepend_y: Annotated[List[float], AfterValidator(validate_monotonically_increasing)] append_y: Annotated[List[float], AfterValidator(validate_monotonically_increasing)] - hyperconfig: Optional[PiecewiseLinearGPSurrogateHyperconfig] = Field( + hyperconfig: Optional[PiecewiseLinearGPSurrogateHyperconfig] = Field( # type: ignore default_factory=lambda: PiecewiseLinearGPSurrogateHyperconfig() ) From be70f2c04b33876ba6c56d57a2d0a87f60abd2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20P=2E=20D=C3=BCrholt?= Date: Wed, 6 Nov 2024 15:36:47 +0100 Subject: [PATCH 2/3] please pyright --- bofire/utils/torch_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bofire/utils/torch_tools.py b/bofire/utils/torch_tools.py index d6a9269b3..e87e19b40 100644 --- a/bofire/utils/torch_tools.py +++ b/bofire/utils/torch_tools.py @@ -638,7 +638,7 @@ def generator(n: int, q: int, seed: int) -> Tensor: return generator -@torch.jit.script +@torch.jit.script # type: ignore def interp1d( x: torch.Tensor, y: torch.Tensor, From 24eccc8605ca95d1e148d67c4d4185573c77716c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20P=2E=20D=C3=BCrholt?= Date: Wed, 6 Nov 2024 15:45:04 +0100 Subject: [PATCH 3/3] remove wrong optional --- bofire/data_models/dataframes/dataframes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bofire/data_models/dataframes/dataframes.py b/bofire/data_models/dataframes/dataframes.py index aefb0f4d1..255402a21 100644 --- a/bofire/data_models/dataframes/dataframes.py +++ b/bofire/data_models/dataframes/dataframes.py @@ -36,7 +36,7 @@ class ExperimentOutputValue(OutputValue): class CandidateOutputValue(OutputValue): - value: Optional[Value] = Field(description="The predicted value.") + value: Value = Field(description="The predicted value.") standard_deviation: float objective_value: float