Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alain Shakour
clowdflows
Commits
3549f035
Commit
3549f035
authored
Dec 10, 2014
by
Anze Vavpetic
Browse files
use comma separated arff instead of bags of features
parent
b7317ca3
Changes
1
Hide whitespace changes
Inline
Side-by-side
workflows/ilp/aleph/aleph.py
View file @
3549f035
...
...
@@ -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
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment