Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Salary Prediction -- Linear vs Polynomial Regression

Python scikit-learn Matplotlib

Predicting salary based on years of experience using both Linear Regression and Polynomial Regression (degree 10), with a Tkinter GUI for interactive predictions.


Overview

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.


Dataset

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

How It Works

  1. Data Loading -- Reads the CSV dataset using Pandas
  2. Model Training -- Fits both a Linear Regression and a Polynomial Regression (degree 10) model using scikit-learn
  3. Visualization -- Generates Matplotlib scatter plots with fitted curves for both models
  4. Interactive Prediction -- A Tkinter GUI allows the user to enter years of experience and see predicted salaries from both models

Project Structure

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

Installation

git clone https://github.com/Samudyata/Salary-Prediction.git
cd Salary-Prediction

pip install -r requirements.txt

Usage

python salary_prediction.py

This will:

  1. Display a Polynomial Regression plot (smooth curve)
  2. Display a Linear Regression plot (straight line)
  3. Open a Tkinter window where you can enter years of experience and get salary predictions from both models

Sample Output

  • 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

Author

Samudyata Jagirdar

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages