-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* less max_parallelism * fixed test parametrization * removed max_parallel-test * added valid/invalid serializations to tests * register invalid * separate transform data model * ignore vscode's devcontainer * separate api file * added init and TF constructor * rename to `DropDataTransform` * Apply suggestions from code review Co-authored-by: Johannes P. Dürholt <[email protected]> * Apply suggestions from code review Co-authored-by: Johannes P. Dürholt <[email protected]> * docstring, register valid specs, rename to untransform_candidates * move test to separate file and extend --------- Co-authored-by: Johannes P. Dürholt <[email protected]>
- Loading branch information
1 parent
ccb0bc2
commit 7909654
Showing
21 changed files
with
294 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from bofire.data_models.transforms.drop_data import DropDataTransform | ||
|
||
AnyTransform = DropDataTransform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from typing import List, Literal, Optional | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class DropDataTransform(BaseModel): | ||
type: Literal["DropDataTransform"] = "DropDataTransform" | ||
to_be_removed_experiments: Optional[List[int]] = None | ||
to_be_removed_candidates: Optional[List[int]] = None |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from typing import Dict, Type | ||
|
||
import bofire.data_models.transforms.api as data_models | ||
from bofire.transforms.drop_data import DropDataTransform | ||
from bofire.transforms.transform import Transform | ||
|
||
TRANSFORM_MAP: Dict[Type[data_models.AnyTransform], Type[Transform]] = { | ||
data_models.DropDataTransform: DropDataTransform | ||
} | ||
|
||
|
||
def map(data_model: data_models.AnyTransform) -> Transform: | ||
return TRANSFORM_MAP[data_model.__class__](data_model) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pandas as pd | ||
|
||
from bofire.data_models.transforms.api import DropDataTransform as DataModel | ||
from bofire.transforms.transform import Transform | ||
|
||
|
||
class DropDataTransform(Transform): | ||
def __init__(self, data_model: DataModel): | ||
self.to_be_removed_experiments = data_model.to_be_removed_experiments or [] | ||
self.to_be_removed_candidates = data_model.to_be_removed_candidates or [] | ||
|
||
def transform_experiments(self, experiments: pd.DataFrame) -> pd.DataFrame: | ||
return experiments.drop(self.to_be_removed_experiments) | ||
|
||
def transform_candidates(self, candidates: pd.DataFrame) -> pd.DataFrame: | ||
return candidates.drop(self.to_be_removed_candidates) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pandas as pd | ||
|
||
from bofire.data_models.domain.api import Domain | ||
|
||
|
||
class Transform: | ||
def __init__(self, *_args, **_kwargs) -> None: | ||
pass | ||
|
||
def transform_experiments(self, experiments: pd.DataFrame) -> pd.DataFrame: | ||
return experiments | ||
|
||
def transform_candidates(self, candidates: pd.DataFrame) -> pd.DataFrame: | ||
return candidates | ||
|
||
def transform_domain(self, domain: Domain) -> Domain: | ||
return domain | ||
|
||
def untransform_candidates(self, experiments: pd.DataFrame) -> pd.DataFrame: | ||
return experiments |
Oops, something went wrong.