def mutualinfo(px, py, pxpy, logbase=2):
 if ((not _isproperdist(px)) or (not _isproperdist(py))):
  raise ValueError('px or py is not a proper probability distribution')
 if ((pxpy != None) and (not _isproperdist(pxpy))):
  raise ValueError('pxpy is not a proper joint distribtion')
 if (pxpy == None):
  pxpy = np.outer(py, px)
 return (shannonentropy(px, logbase=logbase) - condentropy(px, py, pxpy, logbase=logbase))

def mutualinfo ( px , py , pxpy , logbase = 2 ) : if ( ( not _isproperdist ( px ) ) or ( not _isproperdist ( py ) ) ) : raise ValueError ( 'px or py is not a proper probability distribution' ) if ( ( pxpy != None ) and ( not _isproperdist ( pxpy ) ) ) : raise ValueError ( 'pxpy is not a proper joint distribtion' ) if ( pxpy == None ) : pxpy = np . outer ( py , px ) return ( shannonentropy ( px , logbase = logbase ) - condentropy ( px , py , pxpy , logbase = logbase ) )
returns the mutual information between x and y .