Sha256: c68bb3ddba77e77e6943494266b79a1d85391bb93d805b0a046d7b4d99ff96bf
Contents?: true
Size: 876 Bytes
Versions: 5
Compression:
Stored size: 876 Bytes
Contents
# frozen_string_literal: true require 'numo/narray' require 'mopti/version' require 'mopti/nelder_mead' require 'mopti/scaled_conjugate_gradient' # Mopti is a multivariate optimization library in Ruby. module Mopti module_function # Perform minization of the objective function. # # @param algorithm [String] Type of optimizer. # - 'SCG': ScaledConjugateGradient # - 'Nelder-Mead': NelderMead # @return [Hash] Result of optimization. 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 end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
mopti-0.2.3 | lib/mopti.rb |
mopti-0.2.2 | lib/mopti.rb |
mopti-0.2.1 | lib/mopti.rb |
mopti-0.2.0 | lib/mopti.rb |
mopti-0.1.0 | lib/mopti.rb |