Skip to content

Commit

Permalink
ep1fix: consertar compatibilidade com coursera
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-barzilay committed Feb 18, 2024
1 parent 284905e commit a01c183
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion EP 1/sgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def sgd(f,
exploss = loss
else:
exploss = .95 * exploss + .05 * loss
print("iter %d: %f" % (iter, exploss))
print(f"Iteração No.{iter}, Loss: {exploss:f}")

if iter % SAVE_PARAMS_EVERY == 0 and useSaved:
save_params(iter, x)
Expand Down Expand Up @@ -132,6 +132,9 @@ def sanity_check():
print("TODOS OS TESTES FORAM PASSADOS")
print("-" * 40)

def main():
# main pro autograder do coursera, não mexer
sanity_check()

if __name__ == "__main__":
sanity_check()
3 changes: 3 additions & 0 deletions EP 1/word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@ def getRandomContext(C):
skipgram, dummy_tokens, dummy_vectors, dataset, negSamplingLossAndGradient
)

def main():
# main pro autograder do coursera, não mexer
test_word2vec()

if __name__ == "__main__":
test_word2vec()

0 comments on commit a01c183

Please sign in to comment.