Skip to content

Commit 6449a92

Browse files
Merge pull request #271 from eodole/dev
Final adapter Documentation
2 parents 1a0997f + 9f77043 commit 6449a92

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

bayesflow/adapters/transforms/filter_transform.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ def __call__(self, key: str, value: np.ndarray, inverse: bool) -> bool:
1919

2020
@serializable(package="bayesflow.adapters")
2121
class FilterTransform(Transform):
22+
"""
23+
Implements a transform that applies a different transform on a subset of the data. Used by other transforms and
24+
base adapter class.
25+
"""
26+
2227
def __init__(
2328
self,
2429
*,

bayesflow/adapters/transforms/rename.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@
77

88
@serializable(package="bayesflow.adapters")
99
class Rename(Transform):
10+
"""
11+
Transform to rename keys in data dictionary. Useful to rename variables to match those required by
12+
approximator. This transform can only rename one variable at a time.
13+
14+
Parameters:
15+
- from_key: str of variable name that should be renamed
16+
- to_key: str representing new name
17+
18+
Example:
19+
adapter = (
20+
bf.adapters.Adapter()
21+
22+
# rename the variables to match the required approximator inputs
23+
.rename("theta", "inference_variables")
24+
.rename("x", "inference_conditions")
25+
)
26+
"""
27+
1028
def __init__(self, from_key: str, to_key: str):
1129
super().__init__()
1230
self.from_key = from_key

0 commit comments

Comments
 (0)