From 5ddc763ab9953eebdaf78af4eb72288d7955b310 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 14 Jun 2014 19:03:21 +0200 Subject: cleanup --- data/spambase/svm_light_format.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 data/spambase/svm_light_format.rb (limited to 'data/spambase/svm_light_format.rb') diff --git a/data/spambase/svm_light_format.rb b/data/spambase/svm_light_format.rb new file mode 100755 index 0000000..2da4456 --- /dev/null +++ b/data/spambase/svm_light_format.rb @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby + + +while line = STDIN.gets + line.strip! + a = line.split ',' + label = a[-1].to_i + label = -1 if label==0 + 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