Skip to content

Commit 7f90933

Browse files
committed
added explaination for keep transform
1 parent e8d7448 commit 7f90933

File tree

1 file changed

+21
-0
lines changed
  • bayesflow/adapters/transforms

1 file changed

+21
-0
lines changed

bayesflow/adapters/transforms/keep.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,27 @@
1111

1212
@serializable(package="bayesflow.adapters")
1313
class Keep(Transform):
14+
'''
15+
Name the data parameters that should be kept for futher calculation.
16+
17+
Parameters:
18+
19+
cls: tuple containing the names of kept data variables as strings.
20+
21+
Example:
22+
Two moons simulator generates data for priors alpha, r and theta as well as observation data x.
23+
We are interested only in theta and x, to keep only theta and x we should use the following;
24+
25+
adapter = (
26+
bf.adapters.Adapter()
27+
28+
# drop data from unneeded priors alpha, and r
29+
.keep(("theta", "x"))
30+
31+
)
32+
33+
34+
'''
1435
def __init__(self, keys: Sequence[str]):
1536
self.keys = keys
1637

0 commit comments

Comments
 (0)