aa9e1d66eed11e425d177ad6af114877b736bb25,rbm/rbm_complex.py,RBM,train,#RBM#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#,314
Before Change
r=lr)
vis = self.generate_visible_space()
for ep in progress_bar(range(epochs + 1), desc="Epochs ",
total=epochs, disable=disable_progbar):
random_permutation = torch.randperm(data.shape[0])
shuffled_data = data[random_permutation]
shuffled_character_data = character_data[random_permutation]
batches = [shuffled_data[batch_start:(batch_start + batch_size)]
for batch_start in range(0, len(data), batch_size)]
char_batches = [shuffled_character_data[batch_start:(batch_start + batch_size)]
for batch_start in range(0, len(data), batch_size)]
if ep % log_every == 0:
logZ = self.log_partition(vis)
nll = self.nll(data, logZ)
tqdm.write("{}: {}".format(ep, nll.item() / len(data)))
if ep == epochs:
break
stddev = torch.tensor(
[initial_gaussian_noise / ((1 + ep) ** gamma)],
dtype=torch.double, device=self.device).sqrt()
for batch in progress_bar(batches, desc="Batches",
leave=False, disable=True):
grads = self.compute_batch_gradients(k, batch, char_batches,
l1_reg, l2_reg,
After Change
vis = self.generate_visible_space()
print ("Generated visible space. Ready to begin training.")
fidelity_list = []
epoch_list = []
for ep in range(epochs+1):
random_permutation = torch.randperm(data.shape[0])
shuffled_data = data[random_permutation]
shuffled_character_data = character_data[random_permutation]
batches = [shuffled_data[batch_start:(batch_start + batch_size)]
for batch_start in range(0, len(data), batch_size)]
char_batches = [shuffled_character_data[batch_start:(batch_start + batch_size)]
for batch_start in range(0, len(data), batch_size)]
if ep % log_every == 0:
//logZ = self.log_partition(vis)
//nll = self.nll(data, logZ)
fidelity_ = self.fidelity(vis, "Z" "Z")
print ("Epoch = ",ep,"\nFidelity = ",fidelity_)
fidelity_list.append(fidelity_)
//print("Not calculating anything right now, just checking grads.")
if ep == epochs:
fidelity_file = open("fidelity_file.txt", "w")
print ("Finished training. Saving results..." )
for i in range(len(fidelity_list)):
fidelity_file.write("%.5f" % fidelity_list[i] + " %d\n" % epoch_list[i])
break
stddev = torch.tensor(
[initial_gaussian_noise / ((1 + ep) ** gamma)],
dtype=torch.double, device=self.device).sqrt()
for batch_index in range(len(batches)):
grads = self.compute_batch_gradients(k, batches[batch_index], char_batches[batch_index],
l1_reg, l2_reg,
stddev=stddev)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 42
Instances
Project Name: PIQuIL/QuCumber
Commit Name: aa9e1d66eed11e425d177ad6af114877b736bb25
Time: 2018-06-18
Author: ijsdevlu@edu.uwaterloo.ca
File Name: rbm/rbm_complex.py
Class Name: RBM
Method Name: train
Project Name: PIQuIL/QuCumber
Commit Name: aa9e1d66eed11e425d177ad6af114877b736bb25
Time: 2018-06-18
Author: ijsdevlu@edu.uwaterloo.ca
File Name: rbm/rbm_complex.py
Class Name: RBM
Method Name: train
Project Name: PIQuIL/QuCumber
Commit Name: e4541cccd8a40899eaccba48121335593c5069c9
Time: 2018-06-18
Author: 34751083+isaacdevlugt@users.noreply.github.com
File Name: rbm/rbm_complex.py
Class Name: RBM
Method Name: train
Project Name: PIQuIL/QuCumber
Commit Name: 8915257273da0a9a2ccdc3ea75bf6d2d9b2afab9
Time: 2018-06-13
Author: 34751083+isaacdevlugt@users.noreply.github.com
File Name: rbm/rbm_complex.py
Class Name: RBM
Method Name: train