From daf086a43eeaa7752271392e8641b41d4dc5662e Mon Sep 17 00:00:00 2001 From: Dustin Tran Date: Sun, 21 Jan 2018 22:01:10 -0800 Subject: [PATCH] Make miscellaneous revisions for version 1.3.5 (#828) * make miscellaneous revisions * version 1.3.5 * fix pep8 --- edward/__init__.py | 28 +++++++++++++++------------- edward/util/random_variables.py | 15 ++++++++------- edward/version.py | 2 +- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/edward/__init__.py b/edward/__init__.py index 4997a89f3..5892f3b65 100644 --- a/edward/__init__.py +++ b/edward/__init__.py @@ -8,20 +8,22 @@ from edward import util # Direct imports for convenience -from edward.criticisms import evaluate, ppc, ppc_density_plot, \ - ppc_stat_hist_plot -from edward.inferences import Inference, MonteCarlo, VariationalInference, \ - HMC, MetropolisHastings, SGLD, SGHMC, \ - KLpq, KLqp, ReparameterizationKLqp, ReparameterizationKLKLqp, \ - ReparameterizationEntropyKLqp, ScoreKLqp, ScoreKLKLqp, ScoreEntropyKLqp, \ - ScoreRBKLqp, WakeSleep, GANInference, BiGANInference, WGANInference, \ - ImplicitKLqp, MAP, Laplace, complete_conditional, Gibbs +from edward.criticisms import ( + evaluate, ppc, ppc_density_plot, ppc_stat_hist_plot) +from edward.inferences import ( + Inference, MonteCarlo, VariationalInference, + HMC, MetropolisHastings, SGLD, SGHMC, + KLpq, KLqp, ReparameterizationKLqp, ReparameterizationKLKLqp, + ReparameterizationEntropyKLqp, ScoreKLqp, ScoreKLKLqp, ScoreEntropyKLqp, + ScoreRBKLqp, WakeSleep, GANInference, BiGANInference, WGANInference, + ImplicitKLqp, MAP, Laplace, complete_conditional, Gibbs) from edward.models import RandomVariable -from edward.util import check_data, check_latent_vars, copy, dot, \ - get_ancestors, get_blanket, get_children, get_control_variate_coef, \ - get_descendants, get_parents, get_session, get_siblings, get_variables, \ - is_independent, Progbar, random_variables, rbf, set_seed, \ - to_simplex, transform +from edward.util import ( + check_data, check_latent_vars, copy, dot, + get_ancestors, get_blanket, get_children, get_control_variate_coef, + get_descendants, get_parents, get_session, get_siblings, get_variables, + is_independent, Progbar, random_variables, rbf, set_seed, + to_simplex, transform) from edward.version import __version__, VERSION from tensorflow.python.util.all_util import remove_undocumented diff --git a/edward/util/random_variables.py b/edward/util/random_variables.py index 82db6218b..dcd0a4596 100644 --- a/edward/util/random_variables.py +++ b/edward/util/random_variables.py @@ -11,11 +11,12 @@ from edward.models.random_variables import TransformedDistribution from edward.models import PointMass from edward.util.graphs import random_variables -from tensorflow.contrib.distributions import bijectors from tensorflow.core.framework import attr_value_pb2 from tensorflow.python.framework.ops import set_shapes_for_outputs from tensorflow.python.util import compat +tfb = tf.contrib.distributions.bijectors + def check_data(data): """Check that the data dictionary passed during inference and @@ -809,13 +810,13 @@ def transform(x, *args, **kwargs): x: RandomVariable. Continuous random variable to transform. *args, **kwargs: optional. - Arguments to overwrite when forming the ``TransformedDistribution``. + Arguments to overwrite when forming the `TransformedDistribution`. For example, manually specify the transformation by passing in - the ``bijector`` argument. + the `bijector` argument. Returns: RandomVariable. - A ``TransformedDistribution`` random variable, or the provided random + A `TransformedDistribution` random variable, or the provided random variable if no transformation was applied. #### Examples @@ -839,13 +840,13 @@ def transform(x, *args, **kwargs): raise AttributeError(msg) if support == '01': - bij = bijectors.Invert(bijectors.Sigmoid()) + bij = tfb.Invert(tfb.Sigmoid()) new_support = 'real' elif support == 'nonnegative': - bij = bijectors.Invert(bijectors.Softplus()) + bij = tfb.Invert(tfb.Softplus()) new_support = 'real' elif support == 'simplex': - bij = bijectors.Invert(bijectors.SoftmaxCentered(event_ndims=1)) + bij = tfb.Invert(tfb.SoftmaxCentered(event_ndims=1)) new_support = 'multivariate_real' elif support in ('real', 'multivariate_real'): return x diff --git a/edward/version.py b/edward/version.py index 36fb36840..8832a6a84 100644 --- a/edward/version.py +++ b/edward/version.py @@ -1,2 +1,2 @@ -__version__ = '1.3.4' +__version__ = '1.3.5' VERSION = __version__