Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| Epoch 0 loss: 0.334 | |
| Epoch 10 loss: 0.305 | |
| Epoch 20 loss: 0.118 | |
| Epoch 30 loss: 0.072 | |
| Epoch 40 loss: 0.049 | |
| Epoch 50 loss: 0.047 | |
| Epoch 60 loss: 0.046 | |
| Epoch 70 loss: 0.037 | |
| Epoch 80 loss: 0.024 | |
| --------------------------------------------------------------------------- |
This file contains hidden or 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
| import torch | |
| def sigmoid(x): | |
| # Sigmoid activation function: f(x) = 1 / (1 + e^(-x)) | |
| sx = 1.0 / (1.0 + torch.exp(-x)) | |
| return sx | |
| # y_true and y_pred are numpy arrays of the same length. | |
| def mse_loss(y_true, y_pred): | |
| return torch.mean((y_true - y_pred) ** 2) |