From 7c94afb01e3b32906fdbc873974d1666416e444c Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 10 Jun 2023 01:32:54 -0300 Subject: [PATCH] wrap funny analysis in SHOWOFF env --- main.py | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/main.py b/main.py index ed9ca39..258cb70 100644 --- a/main.py +++ b/main.py @@ -335,7 +335,8 @@ async def scores(ctx): } normalized_scores = { - model: summed_scores[model] / len(all_hashes) for model in summed_scores + model: round(summed_scores[model] / len(all_hashes), 10) + for model in summed_scores } print("scores are [worst...best]") @@ -346,29 +347,29 @@ async def scores(ctx): reverse=True, ): print(model, normalized_scores[model]) + if os.getenv("SHOWOFF", "0") == "1": + print("[", end="") - print("[", end="") + for bad_md5_hash in sorted( + model_scores[model].keys(), + key=lambda md5_hash: model_scores[model][md5_hash]["score"], + )[:4]: + data = model_scores[model][bad_md5_hash] + if os.getenv("DEBUG", "0") == "1": + print(md5_hash, data["score"], " ".join(data["incorrect_tags"])) + else: + print(data["score"], end=",") + print("...", end="") - for bad_md5_hash in sorted( - model_scores[model].keys(), - key=lambda md5_hash: model_scores[model][md5_hash]["score"], - )[:4]: - data = model_scores[model][bad_md5_hash] - if os.getenv("DEBUG", "0") == "1": - print(md5_hash, data["score"], " ".join(data["incorrect_tags"])) - else: + for good_md5_hash in sorted( + model_scores[model].keys(), + key=lambda md5_hash: model_scores[model][md5_hash]["score"], + reverse=True, + )[:4]: + data = model_scores[model][good_md5_hash] print(data["score"], end=",") - print("...", end="") - for good_md5_hash in sorted( - model_scores[model].keys(), - key=lambda md5_hash: model_scores[model][md5_hash]["score"], - reverse=True, - )[:4]: - data = model_scores[model][good_md5_hash] - print(data["score"], end=",") - - print("]") + print("]") print("most incorrect tags", incorrect_tags_counters[model].most_common(5))