Predicting salary based on years of experience using both Linear Regression and Polynomial Regression (degree 10), with a Tkinter GUI for interactive predictions.
This project compares two regression approaches for salary prediction:
| Model | Description |
|---|---|
| Linear Regression | Fits a straight line to the data -- simple but may underfit non-linear trends |
| Polynomial Regression (degree 10) | Fits a higher-order curve -- captures non-linear salary growth patterns |
Both models are trained on the same dataset and their predictions can be compared side-by-side through the built-in GUI.
The dataset (Salary_data.csv) contains 45 records mapping years of experience to salary:
| Column | Description |
|---|---|
Name |
Years of experience (1--45) |
Salary |
Annual salary in USD |
- Data Loading -- Reads the CSV dataset using Pandas
- Model Training -- Fits both a Linear Regression and a Polynomial Regression (degree 10) model using scikit-learn
- Visualization -- Generates Matplotlib scatter plots with fitted curves for both models
- Interactive Prediction -- A Tkinter GUI allows the user to enter years of experience and see predicted salaries from both models
Salary-Prediction/
|-- salary_prediction.py # Main script (training, visualization, GUI)
|-- Salary_data.csv # Dataset (45 records)
|-- README.md # Project documentation
|-- requirements.txt # Python dependencies
|-- .gitignore # Git ignore rules
git clone https://github.com/Samudyata/Salary-Prediction.git
cd Salary-Prediction
pip install -r requirements.txtpython salary_prediction.pyThis will:
- Display a Polynomial Regression plot (smooth curve)
- Display a Linear Regression plot (straight line)
- Open a Tkinter window where you can enter years of experience and get salary predictions from both models
- Polynomial Regression captures the non-linear salary growth, fitting closely to the data points
- Linear Regression provides a straight-line estimate that works well as a baseline
Samudyata Jagirdar