Skip to content

Commit 576cc71

Browse files
committed
added docs to rename transform
1 parent 25cc326 commit 576cc71

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

bayesflow/adapters/transforms/rename.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@
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+
"""
1027
def __init__(self, from_key: str, to_key: str):
1128
super().__init__()
1229
self.from_key = from_key

0 commit comments

Comments
 (0)