Salary Prediction Model using Machine Learning

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

Machine Learning Dataset

import pandas as pd
import  numpy as np
import  matplotlib.pyplot as plt
from sklearn import linear_model
df=pd.read_excel("D://scikit_data/newemp/employee.xlsx")

df=df.rename(columns={'test_score(out of 10)':'TestScore'})
df=df.rename(columns={'interview_score(out of 10)':'InteviewScore'})
df=df.rename(columns={'salary($)':'Salary'})
my_dict={'zero':0,'one':1,'two':2,'three':3,'four':4,'five':5,'six':6,'seven':7,'eight':8,'nine':9,'ten':10}
df['experience']=df['experience'].map(my_dict)
df.experience=df.experience.fillna(2)
df.TestScore=df.TestScore.fillna(df.TestScore.median())
# print(df)
model=linear_model.LinearRegression()
model.fit(df.drop('Salary',axis='columns'),df.Salary)
# print(model)
exp=float(input("Enter Experience of Employee"))
test=float(input("Enter Test Score of Employee"))
inter=float(input("Enter Interview Score of Employee"))
print("Prediciated Salary: ",model.predict([[exp,test,inter]]))
# print(model.coef_)
# print(model.intercept_)
# salary=39292.171189979104 +exp*2135.12526096+test*-312.7348643+inter*2204.85386221
# print("Fourmla Salary: ",salary)

 

We work very hard to provide you quality material
Could you take 15 seconds and share your happy experience on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *