Skip to content

Commit a835e7d

Browse files
committed
added docs to drop.py but why do we have both drop and keep they seem to be doing the same thing from different directions
1 parent 8927a58 commit a835e7d

File tree

1 file changed

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

1 file changed

+20
-0
lines changed

bayesflow/adapters/transforms/drop.py

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

1212
@serializable(package="bayesflow.adapters")
1313
class Drop(Transform):
14+
"""
15+
Transform to drop variables from further calculation.
16+
17+
Parameters:
18+
keys: list of strings, containing names of data variables that should be dropped
19+
20+
Example:
21+
22+
>>> import bayesflow as bf
23+
>>> a = [1,2,3,4]
24+
>>> b = [[1,2],[3,4]]
25+
>>> c = [[5,6,7,8]]
26+
>>> dat = dict(a=a,b=b,c=c)
27+
>>> dat
28+
{'a': [1, 2, 3, 4], 'b': [[1, 2], [3, 4]], 'c': [[5, 6, 7, 8]]}
29+
>>> drop = bf.adapters.transforms.Drop(("b","c"))
30+
>>> drop.forward(dat)
31+
{'a': [1, 2, 3, 4]}
32+
"""
33+
1434
def __init__(self, keys: Sequence[str]):
1535
self.keys = keys
1636

0 commit comments

Comments
 (0)