summaryrefslogtreecommitdiff
path: root/fake_svm_light
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-05-30 16:24:48 +0200
committerPatrick Simianer <p@simianer.de>2015-05-30 16:24:48 +0200
commite137509a77e3a8c12af32852ebba893dacb53f85 (patch)
tree940b66002d8aeccbc726da6f6073619ca90618d6 /fake_svm_light
parent84618d64e3b763415a237cc244e6ad1a787e9cef (diff)
fake_svm_light: invert data in svm light format
Diffstat (limited to 'fake_svm_light')
-rwxr-xr-xfake_svm_light14
1 files changed, 14 insertions, 0 deletions
diff --git a/fake_svm_light b/fake_svm_light
new file mode 100755
index 0000000..eb074c1
--- /dev/null
+++ b/fake_svm_light
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+
+while line = STDIN.gets
+ a = line.split
+ label = a.shift.to_f
+ label *= -1
+ a.map! { |i|
+ k,v = i.split ":"
+ v = v.to_f*-1
+ "#{k}:#{v}"
+ }
+ puts "#{label} #{a.join ' '}"
+end
+