Make cbc example reproducible

This commit is contained in:
Jensun Ravichandran 2021-05-07 15:46:09 +02:00
parent 11b3e53ecb
commit dd75fbfff8

View File

@ -11,6 +11,9 @@ if __name__ == "__main__":
x_train = x_train[:, [0, 2]] x_train = x_train[:, [0, 2]]
train_ds = pt.datasets.NumpyDataset(x_train, y_train) train_ds = pt.datasets.NumpyDataset(x_train, y_train)
# Reproducibility
pl.utilities.seed.seed_everything(seed=2)
# Dataloaders # Dataloaders
train_loader = torch.utils.data.DataLoader(train_ds, train_loader = torch.utils.data.DataLoader(train_ds,
num_workers=0, num_workers=0,
@ -20,8 +23,8 @@ if __name__ == "__main__":
hparams = dict( hparams = dict(
input_dim=x_train.shape[1], input_dim=x_train.shape[1],
nclasses=3, nclasses=3,
num_components=9, num_components=5,
component_initializer=pt.components.SMI(train_ds), component_initializer=pt.components.SSI(train_ds, noise=0.01),
lr=0.01, lr=0.01,
) )
@ -34,7 +37,7 @@ if __name__ == "__main__":
# Setup trainer # Setup trainer
trainer = pl.Trainer( trainer = pl.Trainer(
max_epochs=50, max_epochs=200,
callbacks=[ callbacks=[
dvis, dvis,
], ],