Created
September 15, 2022 06:50
-
-
Save aryan-jadon/75a02c76bf5120d953f772c68557e61b to your computer and use it in GitHub Desktop.
loss.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.metrics import accuracy_score | |
pred = model(x_test) | |
vloss = loss_fn(pred, y_test) | |
print(f"Loss = {vloss}") | |
## Loss = 0.5756629109382629 | |
pred = model(x_test) | |
_, predict_classes = torch.max(pred, 1) | |
correct = accuracy_score(y_test.cpu(),predict_classes.cpu()) | |
print(f"Accuracy: {correct}") | |
## Accuracy: 0.9736842105263158 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment