diff options
author | Patrick Simianer <p@simianer.de> | 2014-06-14 19:03:21 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-06-14 19:03:21 +0200 |
commit | 5ddc763ab9953eebdaf78af4eb72288d7955b310 (patch) | |
tree | fffaf3d22173feae684b7c02ce86c67cf77c7fec /data/iris/svm_light_format.rb | |
parent | 26c490f404731d053a6205719b6246502c07b449 (diff) |
cleanup
Diffstat (limited to 'data/iris/svm_light_format.rb')
-rwxr-xr-x | data/iris/svm_light_format.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/data/iris/svm_light_format.rb b/data/iris/svm_light_format.rb new file mode 100755 index 0000000..7307262 --- /dev/null +++ b/data/iris/svm_light_format.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 + |