Commit 3549f035 authored by Anze Vavpetic's avatar Anze Vavpetic

use comma separated arff instead of bags of features

parent b7317ca3
......@@ -217,10 +217,11 @@ class Aleph(object):
cat('@DATA')
examples = re.findall(r"example\((\w+),(\[[\d,]*\]),(\w+)\)\.", pl_dataset)
for _, features, cls in examples:
vals = ['%d 1' % (int(fid)-1) for fid in json.loads(features)] + \
['%d %s' % (class_id, cls)]
cat('{%s}' % ', '.join(vals))
vals = []
for i in range(1, class_id):
vals.append('1' if i in json.loads(features) else '0')
vals.append(cls)
cat('%s' % ','.join(vals))
return arff.getvalue()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment