code
stringlengths
3
6.57k
range(self.n_class)
range(i+1,self.n_class)
self.createBinaryClass(i,j)
GPC()
model.setPrior(mean=self.meanfunc, kernel=self.covfunc)
model.useInference(self.newInf)
model.useLikelihood(self.newLik)
model.getPosterior(x,y)
model.predict(xs)
np.zeros((xs.shape[0],self.n_class)
np.zeros((xs.shape[0],self.n_class)
predictive_vote.sum(axis=1)
optimizeAndPredict(self, xs)
points (given by xs)
np.reshape(xs, (xs.shape[0],1)
np.zeros((xs.shape[0],self.n_class)
range(self.n_class)
range(i+1,self.n_class)
self.createBinaryClass(i,j)
GPC()
model.setPrior(mean=self.meanfunc, kernel=self.covfunc)
model.useInference(self.newInf)
model.useLikelihood(self.newLik)
model.optimize(x,y)
model.predict(xs)
np.zeros((xs.shape[0],self.n_class)
np.zeros((xs.shape[0],self.n_class)
predictive_vote.sum(axis=1)
createBinaryClass(self, i,j)
x(data)
y(label)
x(data)
y(label)
range(len(self.y_all)
class_i.append(index)
class_j.append(index)
len(class_i)
len(class_j)
class_i.extend(class_j)
np.concatenate((np.ones((1,n1)
np.ones((1,n2)
GP_FITC(GP)
__init__(self)
super(GP_FITC, self)
__init__()
setData(self, x, y, value_per_axis=5)
shape (n,D)
shape (n,1)
np.reshape(x, (x.shape[0],1)
np.reshape(y, (y.shape[0],1)
np.mean(y)
mean.Const(c)
range(x.shape[1])
np.min(column)
np.max(column)
np.linspace(mini,maxi,value_per_axis)
gridAxis.append(axis)
np.array(list(itertools.product(*gridAxis)
self.covfunc.fitc(self.u)
setPrior(self, mean=None, kernel=None, inducing_points=None)
class. (e.g. mean.Linear()
class. (e.g. cov.RBF()
of (nu,D)
kernel.fitc(inducing_points)
kernel.fitc(self.u)
Exception("To use default inducing points, please call setData()
type(kernel)
GPR_FITC(GP_FITC)
__init__(self)
super(GPR_FITC, self)
__init__()
mean.Zero()
cov.RBF()
lik.Gauss()
inf.FITC_Exact()
opt.Minimize(self)
setNoise(self,log_sigma)
lik.Gauss(log_sigma)
setOptimizer(self, method, num_restarts=None, min_threshold=None, meanRange=None, covRange=None, likRange=None)
if (num_restarts!=None)
or (min_threshold!=None)
pyGPs.Optimization.conf.random_init_conf(self.meanfunc,self.covfunc,self.likfunc)
opt.Minimize(self,conf)
opt.SCG(self,conf)
opt.CG(self,conf)
opt.BFGS(self,conf)
plot(self,axisvals=None)
plt.figure()
np.reshape(self.xs,(self.xs.shape[0],)
np.reshape(self.ym,(self.ym.shape[0],)
np.reshape(self.ys2,(self.ys2.shape[0],)
plt.plot(self.x, self.y, color=DATACOLOR, ls='None', marker='+',ms=12, mew=2)
plt.plot(self.xs, self.ym, color=MEANCOLOR, ls='-', lw=3.)
plt.fill_between(xss,ymm + 2.*np.sqrt(ys22)
np.sqrt(ys22)
plt.grid()
plt.axis(axisvals)
plt.xlabel('input x')
plt.ylabel('output y')
plt.plot(self.u,np.ones_like(self.u)