Module: GridSearch

Defined in:
lib/grid.rb

Class Method Summary collapse

Class Method Details

.runObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/grid.rb', line 11

def self.run
  @c_begin...@c_end.step(@c_step) do |c|
    @g_begin...@g_end.step(@g_step) do |g|
      output = `#{@svm_train} -c #{2**c} -g #{2**g} -v #{@fold} #{@dataset}`
      lines = output.split("\n")
      accuracy = lines[-1].split(" ")[-1].chomp
      puts "#{accuracy} (c = #{2**c}, g = #{2**g})"
    end
  end
end