Skip to content

Video 78 - Evaluation our model's prediction on straight line. #90

Answered by mrdbourke
dsnal asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @dsnal,

Good question!

model.train() is the default state of the model.

So it doesn't always have to be called but it should usually be called after calling model.eval().

For example (the code is just an example and not a full training/testing loop):

# Training loop
model.train() # this is the default
for x in training_data:
    model(x)

# Testing loop
model.eval()
for x in test_data:
    model(x)

So if you're training: call model.train().

And if you're testing/making predictions: call model.eval()

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Sarthak-Singh04
Comment options

Answer selected by dsnal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants