Skip to content

Commit 9795fef

Browse files
committed
docstring fix
1 parent 855b245 commit 9795fef

File tree

3 files changed

+21
-25
lines changed

3 files changed

+21
-25
lines changed

bamt/core/node_models/continuous_distribution.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ class ContinuousDistribution:
3131
however, any custom continuous distribution can be used, as long as it implements
3232
`scipy.stats` interface.
3333
Example Usage:
34-
```python
35-
data = np.random.normal(0, 1, 1000)
36-
dist = ContinuousDistribution()
37-
dist.fit(data, distributions_pool=DistributionPool.SMALL)
38-
samples = dist.sample(10)
39-
```
34+
>>> data = np.random.normal(0, 1, 1000)
35+
>>> dist = ContinuousDistribution()
36+
>>> dist.fit(data, distributions_pool=DistributionPool.SMALL)
37+
>>> samples = dist.sample(10)
4038
"""
4139

4240
SMALL_POOL: Tuple[Type[stats.rv_continuous], ...] = (

bamt/core/node_models/empirical_distribution.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ class EmpiricalDistribution(Distribution):
1010
This class fits an empirical distribution to the provided categorical or discrete data by calculating
1111
the probabilities of unique values and allows sampling from it.
1212
Usage example:
13-
```python
14-
data = ['apple', 'banana', 'apple', 'orange', 'banana', 'banana', 'orange', 'apple']
15-
emp_dist = EmpiricalDistribution()
16-
emp_dist.fit(data)
17-
print(emp_dist)
18-
samples = emp_dist.sample(10)
19-
print(samples)
20-
print(emp_dist.pmf('banana'))
21-
```
13+
>>> data = ['apple', 'banana', 'apple', 'orange', 'banana', 'banana', 'orange', 'apple']
14+
>>> emp_dist = EmpiricalDistribution()
15+
>>> emp_dist.fit(data)
16+
>>> print(emp_dist)
17+
>>> samples = emp_dist.sample(10)
18+
>>> print(samples)
19+
>>> print(emp_dist.pmf('banana'))
20+
2221
"""
2322

2423
def __init__(self) -> None:

bamt/core/nodes/root_nodes/continuous_node.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ class ContinuousNode(RootNode):
1111
These distributions are wrapped in the `ContinuousDistribution` class.
1212
Example Usage:
1313
14-
```python
15-
data = np.random.normal(0, 1, 1000)
16-
dist = ContinuousDistribution()
17-
node = ContinuousNode(distribution=dist)
18-
node.fit(data)
19-
print(node)
20-
samples = node.sample(10)
21-
print(samples)
22-
print(node.get_parents())
23-
```
14+
15+
>>> data = np.random.normal(0, 1, 1000)
16+
>>> dist = ContinuousDistribution()
17+
>>> node = ContinuousNode(distribution=dist)
18+
>>> node.fit(data)
19+
>>> print(node)
20+
>>> samples = node.sample(10)
21+
>>> print(samples)
22+
>>> print(node.get_parents())
2423
"""
2524

2625
def __init__(self, distribution: Optional[ContinuousDistribution] = None):

0 commit comments

Comments
 (0)