skipgram/train.py
def log_loss(self, epoch=-1):
    """ If epoch=-1: log avg. loss of the last 100 batches. Before resetting
    the cnt and current_loss, add them to the totals for the epoch.
    Else: epoch has ended - log its avg. loss, set all counters to zero
    and call save_embeddings(). """
    self.epoch_loss -= self.current_loss
    self.epoch_cnt += self.cnt
    if epoch > 0:
      avg_loss = self.epoch_loss / self.epoch_cnt
      logging.info(f'Avg. loss of epoch {epoch}: {avg_loss}')
      self.epoch_loss = 0
      self.epoch_cnt = 0
      self.save_embeddings(epoch)
    else:
      avg_loss = self.current_loss / self.cnt
      logging.info(f'Avg. loss in the last 100 batches: {avg_loss}')
    self.cnt = 0
    self.current_loss = 0
 If epoch=-1: log avg. loss of the last 100 batches. Before resetting
    the cnt and current_loss, add them to the totals for the epoch.
    Else: epoch has ended - log its avg. loss, set all counters to zero
    and call save_embeddings(). 
If epoch=-1: log avg. loss of the last 100 batches. Before resetting
the cnt and current_loss, add them to the totals for the epoch.
Else: epoch has ended - log its avg. loss, set all counters to zero
and call save_embeddings().
If epoch = - 1 : log avg . loss of the last 100 batches . Before resetting the cnt and current_loss add them to the totals for the epoch . Else : epoch has ended - log its avg . loss set all counters to zero and call save_embeddings () .
def log_loss(self, epoch=-1):
    self.epoch_loss -= self.current_loss
    self.epoch_cnt += self.cnt
    if epoch > 0:
      avg_loss = self.epoch_loss / self.epoch_cnt
      logging.info(f'Avg. loss of epoch {epoch}: {avg_loss}')
      self.epoch_loss = 0
      self.epoch_cnt = 0
      self.save_embeddings(epoch)
    else:
      avg_loss = self.current_loss / self.cnt
      logging.info(f'Avg. loss in the last 100 batches: {avg_loss}')
    self.cnt = 0
    self.current_loss = 0
def log_loss ( self , epoch = - 1 ) : self . epoch_loss -= self . current_loss self . epoch_cnt += self . cnt if epoch > 0 : avg_loss = self . epoch_loss / self . epoch_cnt logging . info ( f'Avg. loss of epoch {epoch}: {avg_loss}' ) self . epoch_loss = 0 self . epoch_cnt = 0 self . save_embeddings ( epoch ) else : avg_loss = self . current_loss / self . cnt logging . info ( f'Avg. loss in the last 100 batches: {avg_loss}' ) self . cnt = 0 self . current_loss = 0
If epoch=-1: log avg.
If epoch = - 1 : log avg .
""" If epoch=-1: log avg. loss of the last 100 batches. Before resetting
    the cnt and current_loss, add them to the totals for the epoch.
    Else: epoch has ended - log its avg. loss, set all counters to zero
    and call save_embeddings(). """
self
epoch