Module: Mopti

Defined in:
lib/mopti.rb,
lib/mopti/version.rb,
lib/mopti/nelder_mead.rb,
lib/mopti/scaled_conjugate_gradient.rb

Overview

Mopti is a multivariate optimization library in Ruby.

Defined Under Namespace

Classes: NelderMead, ScaledConjugateGradient

Constant Summary collapse

VERSION =

The version of Mopti you are using.

'0.2.2'

Class Method Summary collapse

Class Method Details

.minimize(algorithm:, **args) ⇒ Hash

Perform minization of the objective function.

Parameters:

  • algorithm (String)

    Type of optimizer.

    • ‘SCG’: ScaledConjugateGradient

    • ‘Nelder-Mead’: NelderMead

Returns:

  • (Hash)

    Result of optimization.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mopti.rb', line 19

def minimize(algorithm:, **args)
  optimizer = case algorithm
              when 'SCG'
                ScaledConjugateGradient.new(**args)
              when 'Nelder-Mead'
                NelderMead.new(**args)
              else
                raise ArgumentError, 'A non-existent algorithm is specified'
              end
  res = nil
  optimizer.each { |params| res = params }
  res
end