Class: SVMLabConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/svmlab-config.rb

Instance Method Summary collapse

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

#sayhiObject



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_sObject



182
183
184
# File 'lib/svmlab-config.rb', line 182

def to_s
  @cfg.to_yaml
end