Skip to content

Commit

Permalink
keep old counts as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaz Mramor committed Jan 31, 2024
1 parent 485aa4b commit a16443a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions outrank/task_ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,14 @@ def outrank_task_conduct_ranking(args: Any) -> None:
with open(f'{args.output_folder}/value_repetitions.json', 'w') as out_counts:
out_dict = {}
for k, v in GLOBAL_ITEM_COUNTS.items():
frequencies = list(v.default_counter.values())
frequencies = np.array(list(v.default_counter.values()))
more_than = lambda n, ary: len(np.where(ary > n)[0])
out_dict[k] = {str(x): str(more_than(x, frequencies)) for x in [0] + [1 * 10 ** x for x in range(6)]}
if len(frequencies) < args.histogram_max_bins:
out_dict[k] = sorted(frequencies)
out_dict[k]["quantiles"] = str(sorted(list(frequencies)))
else:
out_dict[k] = quantiles(frequencies, n=args.histogram_max_bins)
out_dict[k]["quantiles"] = str(quantiles(list(frequencies), n=args.histogram_max_bins))
print(out_dict)
out_counts.write(json.dumps(out_dict))

with open(f'{args.output_folder}/combination_estimation_counts.json', 'w') as out_counts:
Expand Down

0 comments on commit a16443a

Please sign in to comment.