diff options
-rwxr-xr-x | bin/analyze-archive.py | 1 | ||||
-rwxr-xr-x | bin/analyze-kconfig.py | 1 | ||||
-rwxr-xr-x | bin/analyze-log.py | 1 | ||||
-rw-r--r-- | lib/cli.py | 5 | ||||
-rw-r--r-- | lib/validation.py | 14 |
5 files changed, 22 insertions, 0 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py index b5cf618..aa1058c 100755 --- a/bin/analyze-archive.py +++ b/bin/analyze-archive.py @@ -436,6 +436,7 @@ def main(): arg_count, force_tree=args.force_tree, compute_stats=not args.skip_param_stats, + show_progress=args.progress, ) xv.parameter_aware = args.parameter_aware_cross_validation else: diff --git a/bin/analyze-kconfig.py b/bin/analyze-kconfig.py index bf965a5..f65751e 100755 --- a/bin/analyze-kconfig.py +++ b/bin/analyze-kconfig.py @@ -424,6 +424,7 @@ def main(): force_tree=args.force_tree, max_std=max_std, compute_stats=not args.skip_param_stats, + show_progress=args.progress, ) xv.parameter_aware = args.parameter_aware_cross_validation else: diff --git a/bin/analyze-log.py b/bin/analyze-log.py index 70df11d..90c658c 100755 --- a/bin/analyze-log.py +++ b/bin/analyze-log.py @@ -162,6 +162,7 @@ def main(): parameter_names, force_tree=args.force_tree, compute_stats=not args.skip_param_stats, + show_progress=args.progress, ) xv.parameter_aware = args.parameter_aware_cross_validation else: @@ -621,6 +621,11 @@ def add_standard_arguments(parser): action="store_true", help="Build regression tree without checking whether static/analytic functions are sufficient.", ) + parser.add_argument( + "--progress", + action="store_true", + help="Show progress bars while executing compute-intensive tasks such as cross-validation.", + ) def parse_shift_function(param_name, param_shift): diff --git a/lib/validation.py b/lib/validation.py index 68f4ddb..6203003 100644 --- a/lib/validation.py +++ b/lib/validation.py @@ -105,6 +105,7 @@ class CrossValidator: self.parameters = sorted(parameters) self.parameter_aware = False self.export_filename = None + self.show_progress = kwargs.pop("show_progress", False) self.args = args self.kwargs = kwargs @@ -217,6 +218,15 @@ class CrossValidator: ret = dict() models = list() + if self.show_progress: + from progress.bar import Bar + + if static: + title = "Static XV" + else: + title = "Model XV" + bar = Bar(title, max=len(training_and_validation_sets)) + for name in self.names: ret[name] = dict() for attribute in self.by_name[name]["attributes"]: @@ -226,6 +236,8 @@ class CrossValidator: } for training_and_validation_by_name in training_and_validation_sets: + if self.show_progress: + bar.next() model, (res, raw) = self._single_xv( model_getter, training_and_validation_by_name, static=static ) @@ -238,6 +250,8 @@ class CrossValidator: ret[name][attribute]["modelOutput"].extend( raw[name]["attribute"][attribute]["modelOutput"] ) + if self.show_progress: + bar.finish() if self.export_filename: import json |