Skip to content

Commit 890a529

Browse files
authored
add __dir__ implementation for SingleGroupApproximations (#3076)
* add __dir__ implementation for SingleGroupApproximations This adds nice autocomplition properties and makes life easier * increment release notes
1 parent 10c9330 commit 890a529

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- Add `model_to_graphviz` (which uses the optional dependency `graphviz`) to
2727
plot a directed graph of a PyMC3 model using plate notation.
2828
- Add beta-ELBO variational inference as in beta-VAE model (Christopher P. Burgess et al. NIPS, 2017)
29+
- Add `__dir__` to `SingleGroupApproximation` to improve autocompletion in interactive environments
2930

3031
### Fixes
3132

pymc3/variational/approximations.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,11 @@ def __init__(self, *args, **kwargs):
539539
def __getattr__(self, item):
540540
return getattr(self.groups[0], item)
541541

542+
def __dir__(self):
543+
d = set(super(SingleGroupApproximation, self).__dir__())
544+
d.update(self.groups[0].__dir__())
545+
return list(sorted(d))
546+
542547

543548
class MeanField(SingleGroupApproximation):
544549
__doc__ = """**Single Group Mean Field Approximation**

0 commit comments

Comments
 (0)