Skip to content

Commit 0a02391

Browse files
committed
update variational_api_quickstart.ipynb
1 parent 298fa23 commit 0a02391

File tree

3 files changed

+170
-193
lines changed

3 files changed

+170
-193
lines changed

docs/source/notebooks/variational_api_quickstart.ipynb

Lines changed: 168 additions & 189 deletions
Large diffs are not rendered by default.

pymc3/variational/inference.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def _iterate_without_loss(self, s, _, step_func, progress, callbacks):
131131
if np.isnan(self.approx.params[0].get_value()).any():
132132
raise FloatingPointError('NaN occurred in optimization.')
133133
for callback in callbacks:
134-
callback(self.approx, None, i)
134+
callback(self.approx, None, i+s+1)
135135
except (KeyboardInterrupt, StopIteration) as e:
136136
progress.close()
137137
if isinstance(e, StopIteration):
@@ -168,7 +168,7 @@ def _infmean(input_array):
168168
progress.set_description(
169169
'Average Loss = {:,.5g}'.format(avg_loss))
170170
for callback in callbacks:
171-
callback(self.approx, scores[:i + 1], i)
171+
callback(self.approx, scores[:i + 1], i+s+1)
172172
except (KeyboardInterrupt, StopIteration) as e: # pragma: no cover
173173
# do not print log on the same line
174174
progress.close()

pymc3/variational/opvi.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ def add_obj_updates(self, updates, obj_n_mc=None, obj_optimizer=adagrad_window,
239239
if self.op.returns_loss:
240240
updates.loss = obj_target
241241

242-
@memoize
243242
@change_flags(compute_test_value='off')
244243
def step_function(self, obj_n_mc=None, tf_n_mc=None,
245244
obj_optimizer=adagrad_window, test_optimizer=adagrad_window,
@@ -303,7 +302,6 @@ def step_function(self, obj_n_mc=None, tf_n_mc=None,
303302
step_fn = theano.function([], None, updates=updates, **fn_kwargs)
304303
return step_fn
305304

306-
@memoize
307305
@change_flags(compute_test_value='off')
308306
def score_function(self, sc_n_mc=None, more_replacements=None, fn_kwargs=None): # pragma: no cover
309307
R"""Compile scoring function that operates which takes no inputs and returns Loss

0 commit comments

Comments
 (0)