From 26c490f404731d053a6205719b6246502c07b449 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 14 Jun 2014 16:46:27 +0200 Subject: init --- data/iris/2svmlight.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 data/iris/2svmlight.rb (limited to 'data/iris/2svmlight.rb') 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 + -- cgit v1.2.3