e46c499eb6f5a8bf8c1abd914e9e5b6818f07d1a,pyprob/state.py,,sample,#Any#Any#Any#Any#,82
Before Change
current_sample = Sample(distribution, distribution.sample(), address, instance, log_prob=0, control=control, replace=replace)
else: // _trace_mode == TraceMode.LIGHTWEIGHT_METROPOLIS_HASTINGS:
current_sample = Sample(distribution, distribution.sample(), address, instance, control=True, replace=False)
if _metropolis_hastings_trace is not None:
if current_sample.address == _metropolis_hastings_proposal_address or current_sample.address not in _metropolis_hastings_trace._samples_all_dict_address:
value = distribution.sample()
reused = False
else:
value = _metropolis_hastings_trace._samples_all_dict_address[current_sample.address].value
reused = True
current_sample = Sample(distribution, value, address, instance, control=True, replace=False, reused=reused)
_current_trace.add_sample(current_sample)
return current_sample.value
After Change
value = _metropolis_hastings_trace._samples_all_dict_address[current_sample.address].value
reused = True
try: // Takes care of issues such as changed distribution parameters (e.g., batch size) that prevent a rescoring of a reused value under this distribution.
log_prob = distribution.log_prob(value)
except:
value = distribution.sample()
log_prob = distribution.log_prob(value)
reused = False
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: pyprob/pyprob
Commit Name: e46c499eb6f5a8bf8c1abd914e9e5b6818f07d1a
Time: 2018-03-31
Author: atilimgunes.baydin@gmail.com
File Name: pyprob/state.py
Class Name:
Method Name: sample
Project Name: pyprob/pyprob
Commit Name: 6224d2443071fe2603a4792a56e86ba069785ed2
Time: 2018-04-05
Author: atilimgunes.baydin@gmail.com
File Name: pyprob/state.py
Class Name:
Method Name: sample
Project Name: masa-su/pixyz
Commit Name: 80522fbd860187f32fa040cafd0cb5cbd450aee7
Time: 2019-04-08
Author: masa@weblab.t.u-tokyo.ac.jp
File Name: pixyz/losses/elbo.py
Class Name: ELBO
Method Name: __init__