def getStringSummaryOfPrior(Prior): ''' Create string summarizing prior information Returns ------- s : str ''' msg = 'Gaussian-Wishart joint prior on regression weights/prec\n' msg += "Wishart on precision scalar\n" msg += " pnu = %.3g\n" % (Prior.pnu) msg += " ptau = %.3g\n" % (Prior.ptau) msg += " mean = %.3g\n" % (E_d(pnu=Prior.pnu, ptau=Prior.ptau)) w_E_str = np2flatstr(Prior.w_E[:2], fmt='% .2g') P_EE_str = np2flatstr(np.diag(Prior.P_EE)[:2], fmt='% .2g') msg += "Gaussian on regression weight vector\n" msg += " mean = %s\n" % w_E_str msg += " diag[prec] = %s\n" % P_EE_str return msg
def getStringSummaryOfPrior(Prior): ''' Get human-readable summary of specific prior Returns ------- s : str ''' if Prior.D > 2: sfx = ' ...' else: sfx = '' msg = 'independent Gauss-Wishart prior on each dimension\n' msg += "Wishart params \n" msg += " nu = %.3g %s\n" % (Prior.nu, sfx) msg += "beta = %s %s\n" % (np2flatstr(Prior.beta[:2]), sfx) msg += "Expectations\n" msg += 'E[ mean[k]] = \n%s%s\n' % (np2flatstr(Prior.m[:2]), sfx) msg += 'E[ covar[k]] = \n' S = E_CovMat(nu=Prior.nu, beta=Prior.beta[:2]) msg += str(S) + sfx msg = msg.replace('\n', '\n ') return msg