def get_hyperparameters(self): theta = self.covariance.get_hyperparameters() theta = hstack((theta, self.likelihood.get_hyperparameters())) return theta
def get_hyperparameters(self): theta=self.covariance.get_hyperparameters() theta=hstack((theta, self.likelihood.get_hyperparameters())) return theta
from kameleon_mcmc.mcmc.samplers.StandardMetropolis import StandardMetropolis from matplotlib.pyplot import plot from numpy.lib.twodim_base import eye from numpy.ma.core import mean, std, ones, shape from numpy.ma.extras import vstack, hstack import os import sys if __name__ == '__main__': # sample data data_circle, labels_circle = GPData.sample_circle_data(n=40, seed_init=1) data_rect, labels_rect = GPData.sample_rectangle_data(n=60, seed_init=1) # combine data = vstack((data_circle, data_rect)) labels = hstack((labels_circle, labels_rect)) dim = shape(data)[1] # normalise data data -= mean(data, 0) data /= std(data, 0) # plot idx_a = labels > 0 idx_b = labels < 0 plot(data[idx_a, 0], data[idx_a, 1], "ro") plot(data[idx_b, 0], data[idx_b, 1], "bo") # prior on theta and posterior target estimate theta_prior = Gaussian(mu=0 * ones(dim), Sigma=eye(dim) * 5) target=PseudoMarginalHyperparameterDistribution(data, labels, \
from kameleon_mcmc.mcmc.samplers.StandardMetropolis import StandardMetropolis from matplotlib.pyplot import plot from numpy.lib.twodim_base import eye from numpy.ma.core import mean, std, ones, shape from numpy.ma.extras import vstack, hstack import os import sys if __name__ == '__main__': # sample data data_circle, labels_circle=GPData.sample_circle_data(n=40, seed_init=1) data_rect, labels_rect=GPData.sample_rectangle_data(n=60, seed_init=1) # combine data=vstack((data_circle, data_rect)) labels=hstack((labels_circle, labels_rect)) dim=shape(data)[1] # normalise data data-=mean(data, 0) data/=std(data,0) # plot idx_a=labels>0 idx_b=labels<0 plot(data[idx_a,0], data[idx_a,1],"ro") plot(data[idx_b,0], data[idx_b,1],"bo") # prior on theta and posterior target estimate theta_prior=Gaussian(mu=0*ones(dim), Sigma=eye(dim)*5) target=PseudoMarginalHyperparameterDistribution(data, labels, \