diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2020-03-13 14:39:37 +0000 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2020-03-13 14:39:37 +0000 |
| commit | 9eb0b9033cbed8e582f8f94d5bcafb3e63d2586a (patch) | |
| tree | 27593e51c31b9fc9375eb932402182d61a1fad57 /analysis/scripts | |
| parent | update readme (diff) | |
| download | TCPDBench-9eb0b9033cbed8e582f8f94d5bcafb3e63d2586a.tar.gz TCPDBench-9eb0b9033cbed8e582f8f94d5bcafb3e63d2586a.zip | |
clarify warnings
Diffstat (limited to 'analysis/scripts')
| -rw-r--r-- | analysis/scripts/make_table.py | 5 | ||||
| -rw-r--r-- | analysis/scripts/rank_common.py | 13 |
2 files changed, 13 insertions, 5 deletions
diff --git a/analysis/scripts/make_table.py b/analysis/scripts/make_table.py index e4747258..c326775e 100644 --- a/analysis/scripts/make_table.py +++ b/analysis/scripts/make_table.py @@ -310,7 +310,8 @@ def average_results(results): # remove RBOCPDMS for 'best', because it fails too often if experiment == Experiment.best: warning( - "\nWarning: Removing RBOCPDMS (experiment = %s)\n" % experiment + "\nWarning: Removing RBOCPDMS (experiment = %s) due to insufficient results\n" + % experiment ) results = list(filter(lambda r: r.method != Method.rbocpdms, results)) expected_methods.remove(Method.rbocpdms) @@ -322,7 +323,7 @@ def average_results(results): if any(r.score is None for r in dset_results): to_remove.append(dataset) if to_remove: - warning("\nWarning: Filtering out datasets: %r\n" % to_remove) + warning("\nWarning: Filtering out datasets: %r due to incomplete results for some detectors.\n" % to_remove) results = list(filter(lambda r: not r.dataset in to_remove, results)) # check that we are now complete: for all datasets and all methods in the diff --git a/analysis/scripts/rank_common.py b/analysis/scripts/rank_common.py index c47cac77..b1d5af77 100644 --- a/analysis/scripts/rank_common.py +++ b/analysis/scripts/rank_common.py @@ -8,12 +8,16 @@ License: See the LICENSE file. """ +import colorama import json import numpy as np import sys +import termcolor from scipy.stats import rankdata +colorama.init() + def load_data(filename): with open(filename, "r") as fp: @@ -78,13 +82,16 @@ def compute_ranks(results, keep_methods=None, higher_better=True): return avg_ranks, all_ranks +def warning(msg): + termcolor.cprint(msg, "yellow", file=sys.stderr) + + def preprocess_data(data, _type): methods = set([m for dset in data.keys() for m in data[dset].keys()]) methods = sorted(methods) if _type == "best": - print( - "\nWarning: Filtering out RBOCPDMS due to insufficient results.\n", - file=sys.stderr, + warning( + "\nWarning: Filtering out RBOCPDMS due to insufficient results.\n" ) methods = [m for m in methods if not m == "rbocpdms"] |
