fit() method.
trainer.fit(model, train_dataloaders=dataloader)
Once training is complete, we can print the predictions just as we did before.
print("\nComparing observed and predicted values")
print(
"Company A: Observed = 0, Predicted =",
model(torch.tensor([0., 0.5, 0.25, 1.])).detach()
)
print(
"Company B: Observed = 1, Predicted =",
model(torch.tensor([1., 0.5, 0.25, 1.])).detach()
)
This produces the following output:
Comparing observed and predicted values
Company A: Observed = 0, Predicted = tensor(0.0003)
Company B: Observed = 1, Predicted = tensor(0.9287)
As you can see, the predictions have improved significantly after training. The model now produces values that are much closer to the expected outputs.
In the next article, we will explore TensorBoard to analyze what happened during training.
AI agents write code fast. They also silently remove logic, change behavior, and introduce bugs -- without telling you. You often find out in production.
git-lrc fixes this. It hooks into git commit and reviews every diff before it lands. 60-second setup. Completely free.
Any feedback or contributors are welcome! It's online, source-available, and ready for anyone to use.
Give it a β star on Github