Skip to content

Commit a16824b

Browse files
committed
epoch_loss_history
1 parent 480e2f7 commit a16824b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gensim/models/word2vec.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ def __init__(self, sentences=None, corpus_file=None, vector_size=100, alpha=0.02
323323
self.ns_exponent = ns_exponent
324324
self.cbow_mean = int(cbow_mean)
325325
self.epoch_loss = 0.0
326+
self.epoch_loss_history = []
326327
self.min_alpha_yet_reached = float(alpha)
327328
self.corpus_count = 0
328329
self.corpus_total_words = 0
@@ -952,7 +953,7 @@ def train(self, corpus_iterable=None, corpus_file=None, total_examples=None, tot
952953
total_examples=total_examples,
953954
total_words=total_words)
954955

955-
self.epoch_loss = 0.0
956+
self.epoch_loss_history = []
956957

957958
for callback in callbacks:
958959
callback.on_train_begin(self)
@@ -963,6 +964,7 @@ def train(self, corpus_iterable=None, corpus_file=None, total_examples=None, tot
963964
job_tally = 0
964965

965966
for cur_epoch in range(self.epochs):
967+
self.epoch_loss = 0.0
966968
for callback in callbacks:
967969
callback.on_epoch_begin(self)
968970

@@ -980,6 +982,7 @@ def train(self, corpus_iterable=None, corpus_file=None, total_examples=None, tot
980982
raw_word_count += raw_word_count_epoch
981983
job_tally += job_tally_epoch
982984

985+
self.epoch_loss_history.append(self.epoch_loss)
983986
for callback in callbacks:
984987
callback.on_epoch_end(self)
985988

0 commit comments

Comments
 (0)