Skip to content

Add a tracking of global loss in each epoch #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions glove/glove.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,10 @@ def fit(self, matrix, epochs=5, no_threads=2, verbose=False):

for epoch in range(epochs):

if verbose:
print('Epoch %s' % epoch)

# Shuffle the coocurrence matrix
random_state.shuffle(shuffle_indices)

fit_vectors(self.word_vectors,
global_loss = fit_vectors(self.word_vectors,
self.vectors_sum_gradients,
self.word_biases,
self.biases_sum_gradients,
Expand All @@ -129,6 +126,8 @@ def fit(self, matrix, epochs=5, no_threads=2, verbose=False):
self.alpha,
self.max_loss,
int(no_threads))
if verbose:
print('Epoch %s, global loss %s' % (epoch, global_loss))

if not np.isfinite(self.word_vectors).all():
raise Exception('Non-finite values in word vectors. '
Expand Down
Loading