Skip to content

Commit

Permalink
changing l2_regularization_coeff to weight_decay
Browse files Browse the repository at this point in the history
  • Loading branch information
matsen committed Jun 13, 2024
1 parent 7e806b4 commit ecb19fc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion data/cnn_joi_sml-shmoof_small.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ model_hyperparameters:
kmer_length: 3
serialization_version: 0
training_hyperparameters:
l2_regularization_coeff: 1.0e-06
weight_decay: 1.0e-06
learning_rate: 0.1
min_learning_rate: 1.0e-06
6 changes: 3 additions & 3 deletions netam/dnsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def to_crepe(self):
"batch_size",
"learning_rate",
"min_learning_rate",
"l2_regularization_coeff",
"weight_decay",
]
}
encoder = framework.PlaceholderEncoder()
Expand All @@ -448,7 +448,7 @@ def burrito_of_model(
batch_size=1024,
learning_rate=0.1,
min_learning_rate=1e-4,
l2_regularization_coeff=1e-6,
weight_decay=1e-6,
):
model.to(device)
burrito = DNSMBurrito(
Expand All @@ -458,6 +458,6 @@ def burrito_of_model(
batch_size=batch_size,
learning_rate=learning_rate,
min_learning_rate=min_learning_rate,
l2_regularization_coeff=l2_regularization_coeff,
weight_decay=weight_decay,
)
return burrito
12 changes: 6 additions & 6 deletions netam/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def __init__(
batch_size=1024,
learning_rate=0.1,
min_learning_rate=1e-4,
l2_regularization_coeff=1e-6,
weight_decay=1e-6,
name="",
):
"""
Expand All @@ -394,7 +394,7 @@ def __init__(
self.batch_size = batch_size
self.learning_rate = learning_rate
self.min_learning_rate = min_learning_rate
self.l2_regularization_coeff = l2_regularization_coeff
self.weight_decay = weight_decay
self.name = name
self.reset_optimization()
self.bce_loss = nn.BCELoss()
Expand Down Expand Up @@ -425,7 +425,7 @@ def reset_optimization(self, learning_rate=None):
self.optimizer_name,
self.model.parameters(),
lr=learning_rate,
weight_decay=self.l2_regularization_coeff,
weight_decay=self.weight_decay,
)
self.scheduler = ReduceLROnPlateau(
self.optimizer, mode="min", factor=0.5, patience=10
Expand Down Expand Up @@ -763,7 +763,7 @@ def __init__(
batch_size=1024,
learning_rate=0.1,
min_learning_rate=1e-4,
l2_regularization_coeff=1e-6,
weight_decay=1e-6,
name="",
):
super().__init__(
Expand All @@ -774,7 +774,7 @@ def __init__(
batch_size=batch_size,
learning_rate=learning_rate,
min_learning_rate=min_learning_rate,
l2_regularization_coeff=l2_regularization_coeff,
weight_decay=weight_decay,
name=name,
)

Expand Down Expand Up @@ -829,7 +829,7 @@ def to_crepe(self):
for key in [
"learning_rate",
"min_learning_rate",
"l2_regularization_coeff",
"weight_decay",
]
}
encoder = KmerSequenceEncoder(
Expand Down
4 changes: 2 additions & 2 deletions netam/hyper_burrito.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def burrito_of_model(
batch_size=1024,
learning_rate=0.1,
min_learning_rate=1e-4,
l2_regularization_coeff=1e-6,
weight_decay=1e-6,
):
burrito = SHMBurrito(
self.train_dataset,
Expand All @@ -190,6 +190,6 @@ def burrito_of_model(
batch_size=batch_size,
learning_rate=learning_rate,
min_learning_rate=min_learning_rate,
l2_regularization_coeff=l2_regularization_coeff,
weight_decay=weight_decay,
)
return burrito

0 comments on commit ecb19fc

Please sign in to comment.