Class: SVMLabConfig
- Inherits:
-
Object
- Object
- SVMLabConfig
- Defined in:
- lib/svmlab-config.rb
Instance Method Summary collapse
- #[](a) ⇒ Object
- #C=(arg) ⇒ Object
- #e=(arg) ⇒ Object
-
#initialize(cfg) ⇒ SVMLabConfig
constructor
A new instance of SVMLabConfig.
- #sayhi ⇒ Object
- #scales=(scale) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(cfg) ⇒ SVMLabConfig
Returns a new instance of SVMLabConfig.
150 151 152 153 154 155 156 |
# File 'lib/svmlab-config.rb', line 150 def initialize(cfg) @cfg = if cfg.split("\n").size==1 YAML.load(File.new(cfg)) else YAML.load(cfg) end end |
Instance Method Details
#[](a) ⇒ Object
158 159 160 |
# File 'lib/svmlab-config.rb', line 158 def [](a) @cfg[a] end |
#C=(arg) ⇒ Object
174 175 176 |
# File 'lib/svmlab-config.rb', line 174 def C=(arg) @cfg['SVM']['C'] = arg end |
#e=(arg) ⇒ Object
178 179 180 |
# File 'lib/svmlab-config.rb', line 178 def e=(arg) @cfg['SVM']['e'] = arg end |
#sayhi ⇒ Object
186 187 188 |
# File 'lib/svmlab-config.rb', line 186 def sayhi puts "Hello! I'm a SVMLabConfig object!" end |
#scales=(scale) ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/svmlab-config.rb', line 162 def scales=(scale) @cfg['SVM']['Scale'].each{ |k,v| (0...v.size).each { |i| @cfg['SVM']['Scale'][k][i] = if scale.is_a? String scale.dup else scale end } } end |
#to_s ⇒ Object
182 183 184 |
# File 'lib/svmlab-config.rb', line 182 def to_s @cfg.to_yaml end |