This project implements a simple linear regression model using PyTorch to predict salaries based on years of experience. This is a learning project.
This beginner-friendly AI project demonstrates the following:
- Loading and preprocessing data using NumPy and sklearn
- Building a linear regression model with PyTorch
- Training the model using gradient descent
- Visualizing the results with Matplotlib
Install the dependencies using pipenv:
pipenv install
The project uses a dataset named "Salary_dataset.csv". Ensure this file is located in a "datasets" folder in the same directory as the script.
The script will output:
- The training progress, showing the loss for each epoch
- A plot of the training loss over time
- A scatter plot of the original data with the fitted regression line
- The final model parameters (weight and bias)