#add a lower freq sin for the noise freqs = .4*np.pi + 0.01*(np.random.rand(means.shape[0])-.5) phases = 2*np.pi*np.random.rand(means.shape[0]) offsets = 0.3*np.vstack([np.sin(f*X+p).T for f,p in zip(freqs,phases)]) Y = means + offsets + np.random.randn(*means.shape)*0.05 #construct full model Kf = kern.rbf(1,0.01,0.001) Ky1 = kern.rbf(1,0.1,0.001) Ky2 = kern.white(1,0.01) Ky = Ky1 + Ky2 m = MOHGP(X,Kf,Ky,Y, K=Nclust, prior_Z = 'DP', alpha=alpha) m.ensure_default_constraints() m.checkgrad(verbose=1) m.randomize() m.optimize() m.systematic_splits() m.systematic_splits() m.plot(1,1,1,0,0,1) #construct model without structure #give it a fighting chance by normalising signals first Y = Y.copy() Y -= Y.mean(1)[:,None] Y /= Y.std(1)[:,None] Kf = kern.rbf(1,0.01,0.001) Ky = kern.white(1,0.01) m2 = MOHGP(X,Kf,Ky,Y, K=Nclust, prior_Z = 'DP', alpha=alpha)
]) #add a lower freq sin for the noise freqs = .4 * np.pi + 0.01 * (np.random.rand(means.shape[0]) - .5) phases = 2 * np.pi * np.random.rand(means.shape[0]) offsets = 0.3 * np.vstack([np.sin(f * X + p).T for f, p in zip(freqs, phases)]) Y = means + offsets + np.random.randn(*means.shape) * 0.05 #construct full model Kf = kern.rbf(1, 0.01, 0.001) Ky1 = kern.rbf(1, 0.1, 0.001) Ky2 = kern.white(1, 0.01) Ky = Ky1 + Ky2 m = MOHGP(X, Kf, Ky, Y, K=Nclust, prior_Z='DP', alpha=alpha) m.ensure_default_constraints() m.checkgrad(verbose=1) m.randomize() m.optimize() m.systematic_splits() m.systematic_splits() m.plot(1, 1, 1, 0, 0, 1) #construct model without structure #give it a fighting chance by normalising signals first Y = Y.copy() Y -= Y.mean(1)[:, None] Y /= Y.std(1)[:, None] Kf = kern.rbf(1, 0.01, 0.001) Ky = kern.white(1, 0.01) m2 = MOHGP(X, Kf, Ky, Y, K=Nclust, prior_Z='DP', alpha=alpha)