Skip to content

model_1.state_dict() shows incorrect values for weight and bias, but predictions are correct #974

Answered by miladnorouziii
Dinerville asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, I saw your code and there are some points.
The number of repetitions for model 1 is set to 2000, but after 550, it's loss is fixed, so there are 1500 repetitions in vain.
Also, the following code is pointless and there is no need for this code.

with torch.no_grad():
plot_predictions(X_train, y_train, X_test, y_test, predictions=y_pred)
you don't need torch.no_grad().

Also, the main problem in this part is:
X = weight * X + bias
It should be y, not X!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Dinerville
Comment options

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