Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Hironsan committed Mar 6, 2018
1 parent c991121 commit 1b44f8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions anago/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
from seqeval.metrics import f1_score


def get_callbacks(log_dir=None, valid=(), checkpoint_dir=None, eary_stopping=True):
def get_callbacks(log_dir=None, valid=(), checkpoint_dir=None, early_stopping=True):
"""Get callbacks.
Args:
log_dir (str): the destination to save logs(for TensorBoard).
valid (tuple): data for validation.
checkpoint_dir (bool): Whether to use checkpoint.
eary_stopping (bool): whether to use early stopping.
early_stopping (bool): whether to use early stopping.
Returns:
list: list of callbacks
Expand All @@ -41,7 +41,7 @@ def get_callbacks(log_dir=None, valid=(), checkpoint_dir=None, eary_stopping=Tru
monitor='f1', save_weights_only=True)
callbacks.append(save_callback)

if eary_stopping:
if early_stopping:
callbacks.append(EarlyStopping(monitor='f1', patience=3, mode='max'))

return callbacks
Expand Down
3 changes: 1 addition & 2 deletions anago/trainer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Model Trainer.
"""

from anago.utils import batch_iter
from anago.callbacks import get_callbacks

Expand Down Expand Up @@ -37,7 +36,7 @@ def train(self, x_train, y_train, x_valid=None, y_valid=None):
# Prepare callbacks
callbacks = get_callbacks(log_dir=self._log_dir,
checkpoint_dir=self._checkpoint_path,
eary_stopping=self._early_stopping,
early_stopping=self._early_stopping,
valid=(valid_steps, valid_batches, self._inverse_transform))

# Train the model
Expand Down

0 comments on commit 1b44f8b

Please sign in to comment.