docs left background
docs right background
  • home
  • project

Marchine Learning App for Salary Prediction

December 30, 2023 (2y ago)

Overview

This is a machine learning app for salary prediction. It is a simple app that uses machine learning to predict the salary of a person based on his/her years of experience. The app is built using python and the machine learning model is built using the scikit-learn library.

Tools

  • Python (Marchine Learning & Backend): Python is a programming language that lets you work quickly and integrate systems more effectively. It is used for machine learning and backend development in this project.

  • Next.js (Frontend): Next.js is an open-source development framework built on top of Node.js enabling React based web applications functionalities such as server-side rendering and generating static websites.

Resources

  • Dataset: Salary_Data.csv

Data Preprocessing

  • Data Cleaning: The data is cleaned by removing the rows with missing values.

  • Data Encoding: The data is encoded using the LabelEncoder class from the sklearn.preprocessing module.

  • Class Binding: Initially, the data is bound into multiple classes using the KBinsDiscretizer class from the sklearn.preprocessing module. However, the results were not satisfactory, so we manually bind the classes to achieve better results.

  • Data Balancing: The data is balanced using the RandomUnderSampler class from the imblearn.under_sampling module.

  • Data Splitting: The data is split into training and testing sets.

Model

we train our model with five different algorithms and compare their results. The algorithms are:

  • KNN: K-Nearest Neighbors, it is our baseline model.

  • Decision Tree

  • QDA (Quadratic Discriminant Analysis)

  • Naive Bayes

  • MLP (Multi-Layer Perceptron)

Results

The results of the five algorithms are as follows:

AlgorithmAccuracyPrecisionRecallF1 Score
KNN0.330.350.390.35
Decision Tree0.350.310.300.32
QDA0.34
Naive Bayes0.36
MLP0.56

Frontend & Backend Development

The frontend and backend of the app is developed using Next.js and Python respectively. The frontend is developed using the create-next-app command and the backend is developed using the flask module.

Responsible for the project

I was responsible for the frontend development, training the KNN algorithm, and working on data processing.

Conclusion

Although the results are acceptable, they are not satisfactory for production use. The model's accuracy can be improved by incorporating more data and utilizing more advanced algorithms. The amount and quality of data are crucial factors that impact the accuracy of the model.

Note: The dataset is generated using python faker library.

Screenshots

landing page

Landing page

sending request to server for prediction

Sending request to server for prediction

results

Results

Demo

https://ml.threecup.com/