from mdp.nodes import RBMNode import mdp from numpy import * import time import read_spro X = read_spro.load_mfcc_file() rbm = RBMNode(10, X.shape[1]) x2 = X.dot(X.T) print x2.shape mdp_pca = mdp.pca(x2) print X.shape
from read_spro import load_mfcc_file import rbm from numpy import * X = load_mfcc_file() bias = ones((X.shape[0], 1)) #X = hstack((bias, X)) ndata, nfeatures = X.shape nhid = 20 W = zeros(nfeatures) hids = X rbm.trainW(X, hids, W, 10, 0.001) #obs = mydata # (Ndata*Nfeatures array) #obs = addColumnOfOnesForBias(obs) #for layer = 1:5 #WB = zeros(1, N_nodes_in_this_hidden_layer) #out = zeros(Ndata, N_nodes_in_this_hidden_layer) #for datapoint = 1:Ndata #out[datapoint, :] = bolzmannprobs(obs[datapoint,:], other args) #out[datapoint, :] = drawSamplesFrom(out[datapoint, :]) #do a training step with that input and output #obs = addColumnOfOnesForBias(out)
kernel = stats.kde.gaussian_kde(val.T) Z = reshape(kernel(positions.T).T, X.T.shape) p.imshow( rot90(Z) , cmap=p.cm.YlGnBu, extent=[0, 1, 0, 1]) p.plot(dat[0,:], dat[1,:], 'r.') p.axis([0.0, 1.0, 0.0, 1.0]) if __name__ == "__main__": print gmtime() seed(12345) import read_spro features = read_spro.load_mfcc_file() rbm = RBM(features.shape[1],8) rbm.dat = features rbm.Ndat = features.shape[0] rbm.learn(10) print gmtime() kkk=0 p.figure(1) p.plot(xrange(size(rbm.E)),rbm.E, 'b+') p.figure(2)