Jan Mühlnikel
commited on
Commit
·
5ca912a
1
Parent(s):
ffce09a
experiment
Browse files
functions/calc_matches.py
CHANGED
@@ -50,6 +50,10 @@ def calc_matches(filtered_df, project_df, similarity_matrix, top_x):
|
|
50 |
filtered_df_indices = filtered_df.index.to_list()
|
51 |
project_df_indices = project_df.index.to_list()
|
52 |
|
|
|
|
|
|
|
|
|
53 |
st.write(filtered_df_indices)
|
54 |
st.write(project_df_indices)
|
55 |
|
@@ -70,13 +74,16 @@ def calc_matches(filtered_df, project_df, similarity_matrix, top_x):
|
|
70 |
# Get the corresponding similarity values
|
71 |
top_values = match_matrix.data[linear_indices]
|
72 |
|
|
|
|
|
|
|
73 |
# Create resulting dataframes with top matches and their similarity scores
|
74 |
st.write(top_indices)
|
75 |
-
p1_df = filtered_df.loc[
|
76 |
p1_df['similarity'] = top_values
|
77 |
|
78 |
st.dataframe(p1_df)
|
79 |
-
p2_df = project_df.loc[
|
80 |
p2_df['similarity'] = top_values
|
81 |
st.dataframe(p2_df)
|
82 |
print("finished calc matches")
|
|
|
50 |
filtered_df_indices = filtered_df.index.to_list()
|
51 |
project_df_indices = project_df.index.to_list()
|
52 |
|
53 |
+
# Create mapping dictionaries
|
54 |
+
filtered_df_index_map = {index: i for i, index in enumerate(filtered_df_indices)}
|
55 |
+
project_df_index_map = {index: i for i, index in enumerate(project_df_indices)}
|
56 |
+
|
57 |
st.write(filtered_df_indices)
|
58 |
st.write(project_df_indices)
|
59 |
|
|
|
74 |
# Get the corresponding similarity values
|
75 |
top_values = match_matrix.data[linear_indices]
|
76 |
|
77 |
+
top_filtered_df_indices = [filtered_df_indices[i] for i in top_indices[0]]
|
78 |
+
top_project_df_indices = [project_df_indices[i] for i in top_indices[1]]
|
79 |
+
|
80 |
# Create resulting dataframes with top matches and their similarity scores
|
81 |
st.write(top_indices)
|
82 |
+
p1_df = filtered_df.loc[top_filtered_df_indices].copy()
|
83 |
p1_df['similarity'] = top_values
|
84 |
|
85 |
st.dataframe(p1_df)
|
86 |
+
p2_df = project_df.loc[top_project_df_indices].copy()
|
87 |
p2_df['similarity'] = top_values
|
88 |
st.dataframe(p2_df)
|
89 |
print("finished calc matches")
|