From b9019b73d4898ece5eceded4c7dee21bc1e70741 Mon Sep 17 00:00:00 2001 From: Dustin Tran Date: Mon, 19 Jun 2017 00:41:01 -0700 Subject: [PATCH] make docstrings slightly more consistent --- edward/inferences/gan_inference.py | 3 ++- edward/inferences/gibbs.py | 3 ++- edward/inferences/hmc.py | 3 ++- edward/inferences/implicit_klqp.py | 3 ++- edward/inferences/klpq.py | 3 ++- edward/inferences/klqp.py | 21 ++++++++++++++------- edward/inferences/map.py | 2 +- edward/inferences/variational_inference.py | 3 ++- edward/inferences/wgan_inference.py | 19 ++++++++++--------- 9 files changed, 37 insertions(+), 23 deletions(-) diff --git a/edward/inferences/gan_inference.py b/edward/inferences/gan_inference.py index 43eb28c3b..5eb84439c 100644 --- a/edward/inferences/gan_inference.py +++ b/edward/inferences/gan_inference.py @@ -62,7 +62,8 @@ def __init__(self, data, discriminator): def initialize(self, optimizer=None, optimizer_d=None, global_step=None, global_step_d=None, var_list=None, *args, **kwargs): - """Initialize inference algorithm. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: optimizer: str or tf.train.Optimizer, optional. diff --git a/edward/inferences/gibbs.py b/edward/inferences/gibbs.py index 5ccc341b7..30fbbe5b7 100644 --- a/edward/inferences/gibbs.py +++ b/edward/inferences/gibbs.py @@ -47,7 +47,8 @@ def __init__(self, latent_vars, proposal_vars=None, data=None): super(Gibbs, self).__init__(latent_vars, data) def initialize(self, scan_order='random', *args, **kwargs): - """Initialization. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: scan_order: list or str, optional. diff --git a/edward/inferences/hmc.py b/edward/inferences/hmc.py index 0f94792f5..583ca7b61 100644 --- a/edward/inferences/hmc.py +++ b/edward/inferences/hmc.py @@ -49,7 +49,8 @@ def __init__(self, *args, **kwargs): super(HMC, self).__init__(*args, **kwargs) def initialize(self, step_size=0.25, n_steps=2, *args, **kwargs): - """Initialize inference algorithm. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: step_size: float, optional. diff --git a/edward/inferences/implicit_klqp.py b/edward/inferences/implicit_klqp.py index 0a91bc5f8..a8a1fc1ea 100644 --- a/edward/inferences/implicit_klqp.py +++ b/edward/inferences/implicit_klqp.py @@ -81,7 +81,8 @@ def __init__(self, latent_vars, data=None, discriminator=None, super(GANInference, self).__init__(latent_vars, data) def initialize(self, ratio_loss='log', *args, **kwargs): - """Initialization. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: ratio_loss: str or fn, optional. diff --git a/edward/inferences/klpq.py b/edward/inferences/klpq.py index ca9b99f0d..8bb9d9c81 100644 --- a/edward/inferences/klpq.py +++ b/edward/inferences/klpq.py @@ -45,7 +45,8 @@ def __init__(self, *args, **kwargs): super(KLpq, self).__init__(*args, **kwargs) def initialize(self, n_samples=1, *args, **kwargs): - """Initialization. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: n_samples: int, optional. diff --git a/edward/inferences/klqp.py b/edward/inferences/klqp.py index 71fee92ae..054399690 100644 --- a/edward/inferences/klqp.py +++ b/edward/inferences/klqp.py @@ -51,7 +51,8 @@ def __init__(self, *args, **kwargs): super(KLqp, self).__init__(*args, **kwargs) def initialize(self, n_samples=1, kl_scaling=None, *args, **kwargs): - """Initialization. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: n_samples: int, optional. @@ -136,7 +137,8 @@ def __init__(self, *args, **kwargs): super(ReparameterizationKLqp, self).__init__(*args, **kwargs) def initialize(self, n_samples=1, *args, **kwargs): - """Initialization. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: n_samples: int, optional. @@ -162,7 +164,8 @@ def __init__(self, *args, **kwargs): super(ReparameterizationKLKLqp, self).__init__(*args, **kwargs) def initialize(self, n_samples=1, kl_scaling=None, *args, **kwargs): - """Initialization. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: n_samples: int, optional. @@ -202,7 +205,8 @@ def __init__(self, *args, **kwargs): super(ReparameterizationEntropyKLqp, self).__init__(*args, **kwargs) def initialize(self, n_samples=1, *args, **kwargs): - """Initialization. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: n_samples: int, optional. @@ -229,7 +233,8 @@ def __init__(self, *args, **kwargs): super(ScoreKLqp, self).__init__(*args, **kwargs) def initialize(self, n_samples=1, *args, **kwargs): - """Initialization. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: n_samples: int, optional. @@ -255,7 +260,8 @@ def __init__(self, *args, **kwargs): super(ScoreKLKLqp, self).__init__(*args, **kwargs) def initialize(self, n_samples=1, kl_scaling=None, *args, **kwargs): - """Initialization. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: n_samples: int, optional. @@ -295,7 +301,8 @@ def __init__(self, *args, **kwargs): super(ScoreEntropyKLqp, self).__init__(*args, **kwargs) def initialize(self, n_samples=1, *args, **kwargs): - """Initialization. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: n_samples: int, optional. diff --git a/edward/inferences/map.py b/edward/inferences/map.py index ced47459d..0caa48c6e 100644 --- a/edward/inferences/map.py +++ b/edward/inferences/map.py @@ -69,7 +69,7 @@ def __init__(self, latent_vars=None, data=None): Args: latent_vars: list of RandomVariable or - dict of RandomVariable to RandomVariable. + dict of RandomVariable to RandomVariable. Collection of random variables to perform inference on. If list, each random variable will be implictly optimized using a `PointMass` random variable that is defined diff --git a/edward/inferences/variational_inference.py b/edward/inferences/variational_inference.py index 212044372..e1f8289e9 100644 --- a/edward/inferences/variational_inference.py +++ b/edward/inferences/variational_inference.py @@ -33,7 +33,8 @@ def __init__(self, *args, **kwargs): def initialize(self, optimizer=None, var_list=None, use_prettytensor=False, global_step=None, *args, **kwargs): - """Initialize variational inference. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: optimizer: str or tf.train.Optimizer, optional. diff --git a/edward/inferences/wgan_inference.py b/edward/inferences/wgan_inference.py index 7e51b00d5..dcdd45ff0 100644 --- a/edward/inferences/wgan_inference.py +++ b/edward/inferences/wgan_inference.py @@ -22,6 +22,14 @@ class WGANInference(GANInference): models. These models do not require a tractable density and assume only a program that generates samples. + #### Notes + + Argument-wise, the only difference from `GANInference` is + conceptual: the `discriminator` is better described as a test + function or critic. `WGANInference` continues to use + `discriminator` only to share methods and attributes with + `GANInference`. + #### Examples ```python @@ -30,20 +38,13 @@ class WGANInference(GANInference): inference = ed.WGANInference({x: x_data}, discriminator) ``` - - #### Notes - - Argument-wise, the only difference from `GANInference` is - conceptual: the `discriminator` is better described as a test - function or critic. `WGANInference` continues to use - `discriminator` only to share methods and attributes with - `GANInference`. """ def __init__(self, *args, **kwargs): super(WGANInference, self).__init__(*args, **kwargs) def initialize(self, penalty=10.0, clip=None, *args, **kwargs): - """Initialize inference algorithm. + """Initialize inference algorithm. It initializes hyperparameters + and builds ops for the algorithm's computation graph. Args: penalty: float, optional.