Anisha Bhatnagar
commited on
Commit
·
f6912cd
1
Parent(s):
ce95080
adding model_name to caching
Browse files- utils/interp_space_utils.py +2 -2
- utils/visualizations.py +1 -1
utils/interp_space_utils.py
CHANGED
@@ -828,7 +828,7 @@ def compute_predicted_author(task_authors_df: pd.DataFrame, col_name: str) -> in
|
|
828 |
return predicted_author
|
829 |
|
830 |
|
831 |
-
def compute_precomputed_regions(bg_proj, bg_ids, q_proj, c_proj,
|
832 |
"""
|
833 |
Compute precomputed regions for mystery author and candidates.
|
834 |
|
@@ -843,7 +843,7 @@ def compute_precomputed_regions(bg_proj, bg_ids, q_proj, c_proj, mystery_id, can
|
|
843 |
dict: mapping region names to bounding boxes and author lists
|
844 |
"""
|
845 |
print("Computing sugested regions for zoom...")
|
846 |
-
key = f"{hashlib.md5((str(q_proj.tolist()) + str(c_proj.tolist()) + str(n_neighbors)).encode()).hexdigest()}"
|
847 |
|
848 |
if os.path.exists(REGION_CACHE):
|
849 |
with open(REGION_CACHE, 'rb') as f:
|
|
|
828 |
return predicted_author
|
829 |
|
830 |
|
831 |
+
def compute_precomputed_regions(bg_proj, bg_ids, q_proj, c_proj, model_name, n_neighbors=7):
|
832 |
"""
|
833 |
Compute precomputed regions for mystery author and candidates.
|
834 |
|
|
|
843 |
dict: mapping region names to bounding boxes and author lists
|
844 |
"""
|
845 |
print("Computing sugested regions for zoom...")
|
846 |
+
key = f"{hashlib.md5((model_name + str(q_proj.tolist()) + str(c_proj.tolist()) + str(n_neighbors)).encode()).hexdigest()}"
|
847 |
|
848 |
if os.path.exists(REGION_CACHE):
|
849 |
with open(REGION_CACHE, 'rb') as f:
|
utils/visualizations.py
CHANGED
@@ -519,7 +519,7 @@ def visualize_clusters_plotly(iid, cfg, instances, model_radio, custom_model_inp
|
|
519 |
candidate_ids = task_authors_df['authorID'].iloc[1:4].tolist() # 3 candidate IDs
|
520 |
|
521 |
precomputed_regions = compute_precomputed_regions(
|
522 |
-
bg_proj_for_regions, bg_ids_for_regions, q_proj, c_proj,
|
523 |
)
|
524 |
|
525 |
# Create choices for radio buttons
|
|
|
519 |
candidate_ids = task_authors_df['authorID'].iloc[1:4].tolist() # 3 candidate IDs
|
520 |
|
521 |
precomputed_regions = compute_precomputed_regions(
|
522 |
+
bg_proj_for_regions, bg_ids_for_regions, q_proj, c_proj, model_name
|
523 |
)
|
524 |
|
525 |
# Create choices for radio buttons
|