pl.imshow(oldspec, origin="lower", aspect="auto") pl.show() batchdata = np.asarray(test_data, dtype=theano.config.floatX) delay = 30 # seqlen = [ test_data.shape[0] ] #for multiple files after one another: takes as first input the signal at later time, so delayed training corresponds hidden_layers_sizes = [10] numpy_rng = np.random.RandomState(123) n_dim = [test_data.shape[1]] dbn_tadbn = TADBN( numpy_rng=numpy_rng, n_ins=[n_dim], hidden_layers_sizes=hidden_layers_sizes, sparse=0.0, delay=delay, learning_rate=0.01, ) dbn_tadbn.pretrain( batchdata, plot_interval=5, static_epochs=80, save_interval=10, ae_epochs=80, all_epochs=50, batch_size=5, seqlen=seqlen, )
test_data = np.concatenate((test_data,cepstrum)) #print 'time slizes: %i || input dimensions: %i || window size:%i' %(test_data.shape[0],test_data.shape[1],nfft) batchdata = np.asarray(test_data, dtype=theano.config.floatX) #seqlen = [ test_data.shape[0] ] #for multiple files after one another: takes as first input the signal at later time, so delayed training corresponds numpy_rng = np.random.RandomState(123) n_dim = [test_data.shape[1]] dbn_tadbn = TADBN(numpy_rng=numpy_rng, n_ins=[n_dim], hidden_layers_sizes=hidden_layers_sizes, sparse=sparse, delay=delay, learning_rate=0.01) dbn_tadbn.pretrain(batchdata, plot_interval=5, static_epochs=80, save_interval=10, ae_epochs=80, all_epochs=50, batch_size=5,seqlen=seqlen) output = open('trained_models/useful/' + savedname + '.pkl', 'wb') cPickle.dump(dbn_tadbn, output) output.close() #=============================================================================== # # # sanity check # generated_series = dbn_tadbn.generate(batchdata, n_samples=300)[0,:,:] # output = open('output/gen_' + savednamed + '.pkl', 'wb') # cPickle.dump([generated_series,test_data,delay,hidden_layers_sizes,invD,mu,sigma], output)
import numpy as np import theano test_data = np.array([np.sin(np.arange(400) * 0.2), np.sin(np.arange(400) * 0.4)]).T batchdata = numpy.asarray(test_data, dtype=theano.config.floatX) delay = 0 numpy_rng = numpy.random.RandomState(123) n_dim = [test_data.shape[1]] dbn_tadbn = TADBN(numpy_rng=numpy_rng, n_ins=[n_dim], hidden_layers_sizes=[100], sparse=0.0, delay=delay, learning_rate=0.01) dbn_tadbn.pretrain(batchdata, plot_interval=5, static_epochs=50, save_interval=10, ae_epochs=0, all_epochs=0, batch_size=5) up = dbn_tadbn.propup(batchdata, static=True) up = np.array(up) print up generated_series = dbn_tadbn.generate(batchdata, n_samples=40) plt.figure() plt.subplot(211)
import sys sys.path.append('..') from models.tadbn import TADBN import numpy import numpy as np import theano test_data = np.array([np.sin(np.arange(400) * 0.2), np.sin(np.arange(400) * 0.4)]).T batchdata = numpy.asarray(test_data, dtype=theano.config.floatX) delay = 3 numpy_rng = numpy.random.RandomState(123) n_dim = [test_data.shape[1]] dbn_tadbn = TADBN(numpy_rng=numpy_rng, n_ins=[n_dim], hidden_layers_sizes=[10], sparse=0.0, delay=delay, learning_rate=0.01) up = dbn_tadbn.propup(batchdata, static=False) up = np.array(up) print up.shape, batchdata.shape