-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrecomm_refine.py
58 lines (29 loc) · 1.25 KB
/
recomm_refine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import pandas as pd
df = pd.read_excel('C:\\Users\\This PC\\Desktop\\rec.xlsx')
print(df)
print('For 10th level schooling -> 1','For 12th level schooling -> 2','For any technical diploma -> 3','For bachelor degree -> 4','For master degree -> 5',sep='\n')
print('For Ph.D -> 6')
user_edu = int(input('input your max edu code'))
print('For no degree -> 1','For degree in Technology -> 2','For degree in medical ->3','For degree in arts -> 4', 'For minimum any bachelor degree -> 5',sep = '\n')
user_stream = int(input('input your branch code'))
is_edu = df['education']==user_edu
df1 = df[is_edu]
print(df1)
df2 = df1.copy().loc[df['branch'] == user_stream]
print(df2)
m = df2['no_of_ratings'].quantile(0.90)
mf = df2['no_of_ratings'] > m
print(m)
print('recommended jobs')
print(df2[mf])
print('recommende jobs')
print('initializing-------------------------------------------------------')
C = df['ratings'].mean()
def weighted_rating(x, m=m, C=C):
N = x['no_of_ratings']
S = x['ratings']
return (N/(N+m)*S) + (m/(m+N)*C)
df2['score'] = df2.apply(weighted_rating, axis=1)
#print(df2)
df2 = df2.sort_values('score', ascending=False)
print(df2[['job_name','score']])