Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinvtran committed Sep 27, 2017
1 parent 17fc7fa commit ceabd62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/tex/tutorials/automated-transformations.tex
Expand Up @@ -138,7 +138,7 @@ \subsubsection{Automated Transformations in Inference}
and use the algorithm \href{/api/ed/HMC}{\texttt{ed.HMC}}.

\begin{lstlisting}[language=Python]
from edward.models import Normal
from edward.models import Empirical

qx = Empirical(params=tf.Variable(tf.random_normal([1000])))

Expand Down
15 changes: 4 additions & 11 deletions notebooks/automated_transformations.ipynb
Expand Up @@ -77,7 +77,10 @@
"import edward as ed\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"import tensorflow as tf"
"import tensorflow as tf\n",
"\n",
"from edward.models import Empirical, Gamma, Normal\n",
"from tensorflow.contrib.distributions import bijectors"
]
},
{
Expand All @@ -88,8 +91,6 @@
},
"outputs": [],
"source": [
"from edward.models import Gamma\n",
"\n",
"x = Gamma(1.0, 2.0)"
]
},
Expand Down Expand Up @@ -125,8 +126,6 @@
}
],
"source": [
"from edward.models import Normal\n",
"\n",
"qx = Normal(loc=tf.Variable(tf.random_normal([])),\n",
" scale=tf.nn.softplus(tf.Variable(tf.random_normal([]))))\n",
"\n",
Expand Down Expand Up @@ -160,8 +159,6 @@
},
"outputs": [],
"source": [
"from tensorflow.contrib.distributions import bijectors\n",
"\n",
"x_unconstrained = inference.transformations[x] # transformed prior\n",
"x_transform = x_unconstrained.bijector # transformed prior's transformation\n",
"qx_constrained = ed.transform(qx, bijectors.Invert(x_transform))"
Expand Down Expand Up @@ -237,8 +234,6 @@
}
],
"source": [
"from edward.models import Normal\n",
"\n",
"qx = Empirical(params=tf.Variable(tf.random_normal([1000])))\n",
"\n",
"inference = ed.HMC({x: qx})\n",
Expand Down Expand Up @@ -269,8 +264,6 @@
},
"outputs": [],
"source": [
"from tensorflow.contrib.distributions import bijectors\n",
"\n",
"x_unconstrained = inference.transformations[x] # transformed prior\n",
"x_transform = x_unconstrained.bijector # transformed prior's transformation\n",
"qx_constrained = Empirical(params=x_transform.inverse(qx.params))"
Expand Down

0 comments on commit ceabd62

Please sign in to comment.