Milad Alshomary
commited on
Commit
·
e7bcc02
1
Parent(s):
3269340
updates
Browse files- utils/interp_space_utils.py +2 -2
- utils/ui.py +3 -0
utils/interp_space_utils.py
CHANGED
|
@@ -137,8 +137,8 @@ def instance_to_df(instance, predicted_author=None, ground_truth_author=None):
|
|
| 137 |
|
| 138 |
])
|
| 139 |
|
| 140 |
-
if type(instance['Q_fullText']) == list:
|
| 141 |
-
|
| 142 |
|
| 143 |
return task_authos_df
|
| 144 |
|
|
|
|
| 137 |
|
| 138 |
])
|
| 139 |
|
| 140 |
+
# if type(instance['Q_fullText']) == list:
|
| 141 |
+
# task_authos_df = task_authos_df.groupby('authorID').agg({'fullText': lambda x: list(x)}).reset_index()
|
| 142 |
|
| 143 |
return task_authos_df
|
| 144 |
|
utils/ui.py
CHANGED
|
@@ -135,6 +135,9 @@ def update_task_display(mode, iid, instances, background_df, mystery_file, cand1
|
|
| 135 |
task_authors_df['g2v_vector'] = task_authors_g2v
|
| 136 |
print(f"Gram2Vec feature generation complete")
|
| 137 |
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
#generating html for the task
|
| 140 |
header_html, mystery_html, candidate_htmls = task_HTML(mystery_txt, candidate_texts, predicted_author, ground_truth_author)
|
|
|
|
| 135 |
task_authors_df['g2v_vector'] = task_authors_g2v
|
| 136 |
print(f"Gram2Vec feature generation complete")
|
| 137 |
|
| 138 |
+
# Computing predicted author by checking pairwise cosine similarity over luar embeddings
|
| 139 |
+
col_name = f'{model_name.split("/")[-1]}_style_embedding'
|
| 140 |
+
predicted_author = compute_predicted_author(task_authors_df, col_name)
|
| 141 |
|
| 142 |
#generating html for the task
|
| 143 |
header_html, mystery_html, candidate_htmls = task_HTML(mystery_txt, candidate_texts, predicted_author, ground_truth_author)
|