Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fd9c1e3

Browse files
Made Changes accordingly as said by mentor
1 parent 2104685 commit fd9c1e3

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

‎Salary Predictor/README.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Salary Predictor
22

33

4-
54
This is basically a python script used to predict the average annual salary of person.
65

76
Given the sector he/she wants to work, what are the skills of a person and also for which job post he/she is applying for, this model predicts what could be hos/her average annual salary.

‎Salary Predictor/model.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44

55
# Load dataset
6-
df = pd.read_csv('dataset/cleaned_dataset.csv')
6+
df = pd.read_csv('../Salary Predictor/dataset/cleaned_dataset.csv')
77

88
df_model = df[['avg_salary','Sector','python_yn','job_sim','R_yn','tableau','power bi','ml','dl']]
99

@@ -44,10 +44,10 @@
4444

4545
# Save the model
4646
import pickle
47-
filename = 'models/random_forest2_model.sav'
47+
filename = '../Salary Predictor/models/random_forest2_model.sav'
4848
pickle.dump(gs.best_estimator_, open(filename, 'wb'))
4949

5050
# saving the columns
5151
model_columns = list(X.columns)
52-
with open('models/model_columns1.pkl','wb') as file:
52+
with open('../Salary Predictor/models/model_columns1.pkl','wb') as file:
5353
pickle.dump(model_columns, file)

‎Salary Predictor/script.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import pickle
44

55
# Function to let user choose from various options
6-
def let_user_pick(options):
7-
print("Enter the Sector of Work:")
6+
def let_user_pick(options, str):
7+
print(f"Enter the {str}")
88
for idx, element in enumerate(options):
99
print("{}) {}".format(idx+1,element))
1010
i = input("Enter number: ")
@@ -28,12 +28,12 @@ def know_language(yes_no):
2828

2929
# Take Sector as an input from user
3030
sectors = ['Information Technology','Business Services','Education','Business Services','Finance', 'Government','Travel & Tourism']
31-
sect = let_user_pick(sectors)
31+
sect = let_user_pick(sectors, 'Sector')
3232
df['Sector'][0] = sect
3333

3434
# Take job role as an input from user
3535
job_role = ['Software Enginner', 'data scientist', 'data engineer', 'analyst', 'Machine Learnig Engineer', 'director', 'manager']
36-
job_simp = let_user_pick(job_role)
36+
job_simp = let_user_pick(job_role, 'Job Role')
3737
if job_simp == 'Software Engineer':
3838
job_simp = 'na'
3939
elif job_simp == 'Machine Learnig Engineer':
@@ -60,17 +60,17 @@ def know_language(yes_no):
6060
df['dl'][0] = Deep_Learning
6161

6262
#Load the model
63-
with open('models/random_forest2_model.sav', 'rb') as f:
64-
regressor = pickle.load(f)
63+
with open('../Salary Predictor/models/random_forest2_model.sav', 'rb') as f:
64+
random_forest_model = pickle.load(f)
6565

6666
# load the columns file
67-
with open('models/model_columns1.pkl', 'rb') as f:
67+
with open('../Salary Predictor/models/model_columns1.pkl', 'rb') as f:
6868
model_columns = pickle.load(f)
6969

7070
# Query into the model to fet results
7171
query_ = pd.get_dummies(pd.DataFrame(df, index = [0]), prefix=['Sector','job_sim'], columns=['Sector','job_sim'])
7272
query = query_.reindex(columns = model_columns, fill_value= 0)
73-
prediction = list(regressor.predict(query))
73+
prediction = list(random_forest_model.predict(query))
7474
final_val = round(prediction[0],2)
7575

7676
print(f'Your Estimated Annual Salary will be {final_val}K Dollars')

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /