diff options
author | Patrick Simianer <p@simianer.de> | 2014-06-14 16:46:27 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-06-14 16:46:27 +0200 |
commit | 26c490f404731d053a6205719b6246502c07b449 (patch) | |
tree | 3aa721098f1251dfbf2249ecd2736434c13b1d48 /data/iris/2svmlight.rb |
init
Diffstat (limited to 'data/iris/2svmlight.rb')
-rwxr-xr-x | data/iris/2svmlight.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/data/iris/2svmlight.rb b/data/iris/2svmlight.rb new file mode 100755 index 0000000..7307262 --- /dev/null +++ b/data/iris/2svmlight.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + + +label1 = "Iris-"+ARGV[0] + +while line = STDIN.gets + line.strip! + a = line.split ',' + label = -1 + label = 1 if a[-1]==label1 + a = a[0..a.size-2] + f = [] + a.each_with_index { |i,idx| + f<<"#{idx+1}:#{i.to_f}" + } + puts "#{label} #{f.join(' ')}" +end + |