rbm2 = RBM(n_hidden=n_hidden2, n_visible=n_hidden1, alpha=0.0001, datatype="binary") rbm3 = RBM(n_hidden=n_hidden3, n_visible=n_hidden2, alpha=0.0001, datatype="binary") # rbm4 = RBM(n_hidden=n_hidden4, n_visible=n_hidden3, alpha=0.0001, datatype="binary") for num in range(Epoch): new_w, new_hb, new_vb, ReconErr = rbm1.train(MA_data) print("Epoch: {}, Reconstruction Error: {}".format(num, ReconErr)) for num in range(Epoch): batch_xs = rbm1.passThrough(MA_data) new_w, new_hb, new_vb, ReconErr = rbm2.train(batch_xs) print("Epoch: {}, Reconstruction Error: {}".format(num, ReconErr)) for num in range(Epoch): batch_xs = rbm1.passThrough(MA_data) batch_xs1 = rbm2.passThrough(batch_xs) new_w, new_hb, new_vb, ReconErr = rbm3.train(batch_xs1) print("Epoch: {}, Reconstruction Error: {}".format(num, ReconErr)) temp1 = rbm1.passThrough(MA_data) temp2 = rbm2.passThrough(temp1) temp3 = rbm3.inference(temp2) temp4 = rbm2.passBack(temp3) REC = rbm1.passBack(temp4)