diff options
author | Martin Možina <martin.mozina@fri.uni-lj.si> | 2018-05-20 17:36:11 +0200 |
---|---|---|
committer | Martin Možina <martin.mozina@fri.uni-lj.si> | 2018-05-20 17:36:11 +0200 |
commit | 8723bd7cd2d227634d67f24e9514d88e9f1c73a7 (patch) | |
tree | 5b92bf0360157c7148be13d4e0261bdb2c8ceebd /dynamic | |
parent | 1dbb57208d2b8163a1c007ad0931f859651fc1c2 (diff) |
Added create_data and evaluate_orange.
Diffstat (limited to 'dynamic')
-rw-r--r-- | dynamic/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
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): |