This script demonstrates a basic linear regression using PyTorch to learn the relationship between temperature in Celsius and Fahrenheit.
- Defines a single data point:
37.78°C = 100°F - Trains a simple linear model
y = wx + busing gradient descent - Prints the learned parameters (
weightandbias) every 100 iterations - Uses the trained model to predict the Fahrenheit equivalent of 37.78°C
Only minimal dependencies are needed:
- Python 3.12+
- PyTorch
conda env create celsius-farenheit-pytorch -f environment.yml