From 8723bd7cd2d227634d67f24e9514d88e9f1c73a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mo=C5=BEina?= Date: Sun, 20 May 2018 17:36:11 +0200 Subject: Added create_data and evaluate_orange. --- dynamic/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'dynamic') diff --git a/dynamic/__init__.py b/dynamic/__init__.py index fdcde57..b77dd22 100644 --- a/dynamic/__init__.py +++ b/dynamic/__init__.py @@ -57,6 +57,13 @@ def following_pairs_patterns(trace_data): for v1, v2 in zip(val, val[1:]): yield "[{}]:[{}]".format(v1[2], v2[2]) +def single_value_patterns(trace_data): + series = trace_data['series'] + for se, val in series.items(): + for v in val: + yield "value: {}".format(v[2]) + + def get_trace_data(code, call=None, inputs=None): if call: code += '\n\n' + call @@ -70,6 +77,8 @@ def get_attributes(programs, call, inputs): trace = get_trace_data(program, call, inputs) for pat in following_pairs_patterns(trace): patterns[pat] += [program] + for pat in single_value_patterns(trace): + patterns[pat] += [program] attrs = collections.OrderedDict() for pat, progs in sorted(patterns.items(), key=lambda x: len(x[1]), reverse=True): -- cgit v1.2.1