Salary Prediction Web App
In this article, we are going to discuss how to predict the salary based on various attributes related to salary using Random Forest Regression.
This study focuses on a system that predicts the salary of a candidate based on candidate’s qualifications, historical data, and work experience. This app uses a machine learning algorithm to give the result.
The algorithm used is Random Forest Regression. In this problem, the target variable (or output), y, takes value of salary for a given set of input features (or inputs), X. The dataset contains gender, secondary school percentage, higher secondary school percentage, higher secondary school stream, degree percentage, degree type, work experience and specialization of candidate.
Below is the step-by-step Approach:
Step 2: Now before moving forward we need to pre-process and transform our data. For that, we will use astype() function to change datatype of some columns to category.
Step 3: Now we will apply codes on some columns to convert their text values to numerical values. After applying codes, the dataset will look like this:
Step 4: Now we divide the dataset as x and y. x contains all the input features and y is our output variable that is, Salary.
Step 5: We will split the dataset into train and test data which will be used to check the efficiency.
Step 6: Now we can train our model using training features (x_train, y_train) to build a Random Forest Regression Model.
Step 7: Once we have trained the model we will check the performance of our model using test data. After verifying the performance, our model is ready to deploy. We will save our model using pickle. The pickle module implements a fundamental, but powerful algorithm for serializing and de-serializing a Python object structure.
Build App using streamlit
Streamlit is an open-soource Python library that makes it easy to build beautiful custom web-apps for machine learning and data science.
We will write a streamlit code to create a GUI for taking input features which will predict the Salary of the candidate. After writing the code for app we will save the file as salary_app.py.
To run this web app, open anaconda prompt and type streamlit run salary_app.py. This will open a web page. Enter the required credentials and click on Predict My Salary button. The screenshot of the web app is listed below.
Comments
Post a Comment