Module: GridSearch

Included in:
Array, CartesianIterator, Enumerable
Defined in:
lib/grid_search.rb

Instance Method Summary collapse

Instance Method Details

#argmax(&block) ⇒ Object

Finds the argument which maximizes the function given in the block trhu grid-search maximization.

[-1,0,1,2].argmax {|x| x**2 } #=> 2


6
7
8
# File 'lib/grid_search.rb', line 6

def argmax(&block)
  argbest(:>, &block)
end

#argmin(&block) ⇒ Object

Finds the argument which minimizes the function given in the block trhu grid-search minimization.

[-1,0,1,2].argmin {|x| x**2 } #=> 0


13
14
15
# File 'lib/grid_search.rb', line 13

def argmin(&block)
  argbest(:<, &block)
end