Utilities
Created on Tue May 7 15:39:38 2013
Copyright (C) 2013 James Bono (jwbono@gmail.com)
GNU Affero General Public License
-
pynfg.utilities.utilities.convert_2_pureCPT(anarray)[source]
Convert an arbitrary matrix to a pure CPT w/ weight on maximum elements
Parameters: | anarray (np.array) – The numpy array to be converted to |
Returns: | a normalized conditional probability distribution over actions
given messages with all elements zero or one. |
-
pynfg.utilities.utilities.mh_decision(pnew, pold, qnew=1, qold=1)[source]
Decide to accept the new draw or keep the old one
Parameters: |
- pnew (float) – the unnormalized likelihood of the new draw
- pold – the unnormalized likelihood of the old draw
- qnew (float) – the probability of transitioning from the old draw to the new
draw.
- qold (float) – the probability of transitioning from the new draw to the old
draw.
|
Returns: | either True or False to determine whether the new draw is
accepted.
|