Utilities

Several useful functions for use in various places in PyNFG

Part of: PyNFG - a Python package for modeling and solving Network Form Games

Created on Tue May 7 15:39:38 2013

Copyright (C) 2013 James Bono

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.mceu(Game, dn, N, tol=30, delta=1, verbose=False)[source]

Compute the move-conditioned expected utilities for all parent values

Parameters:
  • Game (SemiNFG or iterSemiNFG) – the SemiNFG of interest
  • dn (str) – the name of the decision node where MCEUs are estimated
  • N (int) – the max number of iterations for the estimation
  • tol (int) – the minimum number of samples per parent value
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.

Previous topic

Q-Learning

This Page

Mailing List

Join the Google Group: