Class: EasyML::Models::Hyperparameters::Base

Inherits:
Object
  • Object
show all
Includes:
GlueGun::DSL
Defined in:
lib/easy_ml/core/models/hyperparameters/base.rb

Direct Known Subclasses

XGBoost

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



24
25
26
# File 'lib/easy_ml/core/models/hyperparameters/base.rb', line 24

def [](key)
  send(key) if respond_to?(key)
end

#[]=(key, value) ⇒ Object



28
29
30
# File 'lib/easy_ml/core/models/hyperparameters/base.rb', line 28

def []=(key, value)
  send("#{key}=", value) if respond_to?("#{key}=")
end

#merge(other) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/easy_ml/core/models/hyperparameters/base.rb', line 16

def merge(other)
  return self if other.nil?

  other_hash = other.is_a?(Hyperparameters) ? other.to_h : other
  merged_hash = to_h.merge(other_hash)
  self.class.new(**merged_hash)
end

#to_hObject



12
13
14
# File 'lib/easy_ml/core/models/hyperparameters/base.rb', line 12

def to_h
  attributes
end