Eran Fainman
commited on
Commit
·
e9e157a
1
Parent(s):
071fa8f
Add application file
Browse files
app.py
CHANGED
@@ -71,7 +71,7 @@ def calculate_metrics(df_pred):
|
|
71 |
df_merged = pd.merge(df_gt, df_pred, how='left', on=['accommodation_id', 'user_id']).fillna('')
|
72 |
df_merged['match_index'] = df_merged.apply(get_match_index, axis=1)
|
73 |
df_merged['mrr10'] = df_merged['match_index'].apply(lambda x: 1/x)
|
74 |
-
df_merged['precision10'] = df_merged.apply(lambda x: 1 if x != np.inf else 0)
|
75 |
|
76 |
return df_merged['mrr10'].mean(), df_merged['precision10'].mean()
|
77 |
|
|
|
71 |
df_merged = pd.merge(df_gt, df_pred, how='left', on=['accommodation_id', 'user_id']).fillna('')
|
72 |
df_merged['match_index'] = df_merged.apply(get_match_index, axis=1)
|
73 |
df_merged['mrr10'] = df_merged['match_index'].apply(lambda x: 1/x)
|
74 |
+
df_merged['precision10'] = df_merged['match_index'].apply(lambda x: 1 if x != np.inf else 0)
|
75 |
|
76 |
return df_merged['mrr10'].mean(), df_merged['precision10'].mean()
|
77 |
|