Пример #1
0
import matplotlib.pyplot as pyplot
import matplotlib.mlab as mlab
import matplotlib.axes
import math

q = 2
Y, lbls = datasets.lvmLoadData('oil')
#Y = Y[0:10, :]
numData = Y.shape[0]
d = Y.shape[1]
#v, X = netlab.pca(Y.transpose(), q)
X = numpy.random.normal(0.0, 1e-1, (numData, 2))
Xstore = X;
Xstor = numpy.empty(Xstore.shape)
Ystore = Y;
Y = ndlwrap.fromarray(Y)
X = ndlwrap.fromarray(X)

# Set up kernel function
kern = nl.cmpndKern()

kern1 = nl.rbfKern(X)
kern2 = nl.biasKern(X)
kern3 = nl.whiteKern(X)
kern3.setVariance(1e-3)

kern.addKern(kern1)
kern.addKern(kern2)
kern.addKern(kern3)

Пример #2
0
q = 2
Y, lbls = datasets.lvmLoadData('oil')
#Y = Y[0:10,:]
numData = Y.shape[0]
d = Y.shape[1]

v, u = netlab.pca(Y, 2)
v[np.nonzero(v<0)]=0
Ymean = Y.mean(axis=0)
Ycentre = Y - Ymean
X = np.mat(Ycentre)*np.mat(u)*np.mat(np.diag(1/v))

Xstore = X;
Xstor = np.empty(Xstore.shape)
Ystore = Y;
Y = nw.fromarray(Y)
X = nw.fromarray(X)

# Set up kernel function
kern = nl.cmpndKern()

kern1 = nl.rbfKern(X)
kern2 = nl.biasKern(X)
kern3 = nl.whiteKern(X)
kern3.setVariance(1e-4)
kern.addKern(kern1)
kern.addKern(kern2)
kern.addKern(kern3)

noise = nl.gaussianNoise(Y)
Пример #3
0
import netlab
import matplotlib.pyplot as pyplot
import matplotlib.mlab as mlab
import matplotlib.axes


q = 2
Y, lbls = datasets.lvmLoadData('oil100')
d = Y.shape[0]
numData = Y.shape[1]
v, X = netlab.pca(Y.transpose(), q)
X = numpy.random.normal(0.0, 1e-6, (Y.shape[0], 2))
Xstore = X;
Xstor = numpy.empty(Xstore.shape)
Ystore = Y;
Y = ndlwrap.fromarray(Y)
X = ndlwrap.fromarray(X)

# Set up kernel function
kern = ndlml.cmpndKern()

kern1 = ndlml.rbfKern(X)
kern2 = ndlml.biasKern(X)
kern3 = ndlml.whiteKern(X)

kern.addKern(kern1)
kern.addKern(kern2)
kern.addKern(kern3)


noise = ndlml.gaussianNoise(Y)
Пример #4
0
q = 2
Y, lbls = datasets.lvmLoadData('oil')
#Y = Y[0:10,:]
numData = Y.shape[0]
d = Y.shape[1]

v, u = netlab.pca(Y, 2)
v[np.nonzero(v < 0)] = 0
Ymean = Y.mean(axis=0)
Ycentre = Y - Ymean
X = np.mat(Ycentre) * np.mat(u) * np.mat(np.diag(1 / v))

Xstore = X
Xstor = np.empty(Xstore.shape)
Ystore = Y
Y = nw.fromarray(Y)
X = nw.fromarray(X)

# Set up kernel function
kern = nl.cmpndKern()

kern1 = nl.rbfKern(X)
kern2 = nl.biasKern(X)
kern3 = nl.whiteKern(X)
kern3.setVariance(1e-4)
kern.addKern(kern1)
kern.addKern(kern2)
kern.addKern(kern3)

noise = nl.gaussianNoise(Y)