Beispiel #1
0
 def check_params(natparam):
     natparam2 = standard_to_natural(*natural_to_standard(natparam))
     assert np.allclose(natparam, natparam2)
Beispiel #2
0
def rand_niw(n):
    S = rand_psd(n) + n * np.eye(n)
    m = npr.randn(n)
    kappa = n + npr.uniform(1, 3)
    nu = n + npr.uniform(1, 3)
    return standard_to_natural(S, m, kappa, nu)
Beispiel #3
0
 def init_niw_natparam(N):
     nu, S, m, kappa = N+niw_conc, (N+niw_conc)*np.eye(N), np.zeros(N), niw_conc
     m = m + random_scale * npr.randn(*m.shape)
     return niw.standard_to_natural(S, m, kappa, nu)
Beispiel #4
0
 def init_niw_natparam(N):
     nu, S, m, kappa = N+niw_conc, (N+niw_conc)*np.eye(N), np.zeros(N), niw_conc
     m = m + random_scale * npr.randn(*m.shape)
     return niw.standard_to_natural(S, m, kappa, nu)
Beispiel #5
0
 def check_params(natparam):
     natparam2 = standard_to_natural(*natural_to_standard(natparam))
     assert np.allclose(natparam, natparam2)
Beispiel #6
0
def rand_niw(n):
    S = rand_psd(n) + n * np.eye(n)
    m = npr.randn(n)
    kappa = n + npr.uniform(1, 3)
    nu = n + npr.uniform(1, 3)
    return standard_to_natural(S, m, kappa, nu)