예제 #1
0
 def set_batch_covariance(self, Z):
     Phi = feature_map(Z, self.omega, self.u)
     self.mu = np.mean(Phi, axis=0)
     self.C = np.cov(Phi.T)
예제 #2
0
 def set_batch_covariance(self, Z):
     Phi = feature_map(Z, self.omega, self.u)
     self.mu = np.mean(Phi, axis=0)
     self.C = np.cov(Phi.T)
예제 #3
0

np.random.seed(0)

# fix basis for now
D = 2
m = 1000
gamma = .3
omega, u = sample_basis(D, m, gamma)

# sample points in input space
N = 2000
Z = sample_banana(N, D)

# fit Gaussian in feature space
Phi = feature_map(Z, omega, u)

# mean and covariance, batch version
mu = np.mean(Phi, 0)
eta = 0.01
C = np.cov(Phi.T) + eta ** 2 * np.eye(m)
L = np.linalg.cholesky(C)

# step size
eta = 50.

plt.plot(Z[:, 0], Z[:, 1], 'bx')

# proposal plotting colors
colors = ['y', 'r', 'g', 'm', 'black']