Skip to content

Commit

Permalink
Fix bug in table creating. Add tabulate to requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Anya497 committed Feb 2, 2024
1 parent be68ecf commit c5a8f9f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion AIAgent/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ def invert_mapping_mrgm_gmmr(
for map_result_mapping in list_of_map_result_mappings:
map, result = (map_result_mapping.map, map_result_mapping.game_result)

inverse_mapping[map].append(Agent2Result(named_agent, result))
inverse_mapping[map.MapName].append(Agent2Result(named_agent, result))

return inverse_mapping
16 changes: 5 additions & 11 deletions AIAgent/epochs_statistics/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ def create_pivot_table(
model_map_results_mapping
)

name_results_dict: defaultdict[int, list[Name2ResultViewModel]] = defaultdict(list)
epoch_percents_dict: defaultdict[int, list[Name2ResultViewModel]] = defaultdict(
name_results_dict: defaultdict[str, list[Name2ResultViewModel]] = defaultdict(list)
epoch_percents_dict: defaultdict[str, list[Name2ResultViewModel]] = defaultdict(
list
)

for map_obj, mutable2result_list in map_results_with_models.items():
for mapName, mutable2result_list in map_results_with_models.items():
for mutable2result in mutable2result_list:
name_results_dict[map_obj.Id].append(convert_to_view_model(mutable2result))
epoch_percents_dict[map_obj.Id].append(
name_results_dict[mapName].append(convert_to_view_model(mutable2result))
epoch_percents_dict[mapName].append(
str(
(
mutable2result.game_result.actual_coverage_percent,
Expand All @@ -75,12 +75,6 @@ def create_pivot_table(
for col in df:
df[col] = df[col].map(lambda name2result_vm: name2result_vm.pretty_result)

maps_indexes = dict(
{(map_obj.Id, map_obj.MapName) for map_obj in map_results_with_models.keys()}
)

df.rename(columns=lambda map_id: maps_indexes[map_id], inplace=True)
epochs_percent_df.rename(columns=lambda map_id: maps_indexes[map_id], inplace=True)
df[EUC_DIST2FULL_COV_COL_NAME] = euc_dists2full_cov
df[AV_COVERAGE_COL_NAME] = avs
df[MEDIAN_COVERAGE_COL_NAME] = medians
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ scipy==1.11.4
six==1.16.0
SQLAlchemy==2.0.25
sympy==1.12
tabulate=0.9.0
threadpoolctl==3.2.0
torch==2.1.2
torch_geometric==2.4.0
Expand Down

0 comments on commit c5a8f9f

Please sign in to comment.