|
12 | 12 | @serializable(package="bayesflow.adapters") |
13 | 13 | class Keep(Transform): |
14 | 14 | """ |
15 | | - Name the data parameters that should be kept for futher calculation. |
| 15 | + Name the data parameters that should be kept for futher calculation. |
16 | 16 |
|
17 | | - Parameters: |
| 17 | + Parameters: |
18 | 18 |
|
19 | | - cls: tuple containing the names of kept data variables as strings. |
| 19 | + cls: tuple containing the names of kept data variables as strings. |
20 | 20 |
|
21 | | - Useage: |
| 21 | + Useage: |
22 | 22 |
|
23 | | - Two moons simulator generates data for priors alpha, r and theta as well as observation data x. |
24 | | - We are interested only in theta and x, to keep only theta and x we should use the following; |
| 23 | + Two moons simulator generates data for priors alpha, r and theta as well as observation data x. |
| 24 | + We are interested only in theta and x, to keep only theta and x we should use the following; |
25 | 25 |
|
26 | | - adapter = ( |
27 | | - bf.adapters.Adapter() |
28 | | -<<<<<<< HEAD |
| 26 | + adapter = ( |
| 27 | + bf.adapters.Adapter() |
| 28 | + <<<<<<< HEAD |
29 | 29 |
|
30 | | - # drop data from unneeded priors alpha, and r |
31 | | -======= |
32 | | - # only keep theta and x |
33 | | ->>>>>>> b8b68757b0ae1a5f34bf656a837abbeb77e2ec62 |
34 | | - .keep(("theta", "x")) |
35 | | - ) |
| 30 | + # drop data from unneeded priors alpha, and r |
| 31 | + ======= |
| 32 | + # only keep theta and x |
| 33 | + >>>>>>> b8b68757b0ae1a5f34bf656a837abbeb77e2ec62 |
| 34 | + .keep(("theta", "x")) |
| 35 | + ) |
36 | 36 |
|
37 | | - Example: |
38 | | - >>> a = [1, 2, 3, 4] |
39 | | - >>> b = [[1, 2], [3, 4]] |
40 | | - >>> c = [[5, 6, 7, 8]] |
41 | | - >>> dat = dict(a=a, b=b, c=c) |
42 | | - # Here we want to only keep elements b and c |
43 | | - >>> keeper = bf.adapters.transforms.Keep(("b", "c")) |
44 | | - >>> keeper.forward(dat) |
45 | | - {'b': [[1, 2], [3, 4]], 'c': [[5, 6, 7, 8]]} |
| 37 | + Example: |
| 38 | + >>> a = [1, 2, 3, 4] |
| 39 | + >>> b = [[1, 2], [3, 4]] |
| 40 | + >>> c = [[5, 6, 7, 8]] |
| 41 | + >>> dat = dict(a=a, b=b, c=c) |
| 42 | + # Here we want to only keep elements b and c |
| 43 | + >>> keeper = bf.adapters.transforms.Keep(("b", "c")) |
| 44 | + >>> keeper.forward(dat) |
| 45 | + {'b': [[1, 2], [3, 4]], 'c': [[5, 6, 7, 8]]} |
46 | 46 |
|
47 | 47 | """ |
48 | 48 |
|
|
0 commit comments