Class: SVMFeaturesConfig::SVMFeatureConfig
- Defined in:
- lib/svmlab-config.rb
Overview
—————-SVMFeatureConfig——————————————–
Instance Method Summary collapse
-
#initialize(maincfg, feature) ⇒ SVMFeatureConfig
constructor
A new instance of SVMFeatureConfig.
- #to_s ⇒ Object
Methods inherited from Hash
Constructor Details
#initialize(maincfg, feature) ⇒ SVMFeatureConfig
Returns a new instance of SVMFeatureConfig.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/svmlab-config.rb', line 67 def initialize(maincfg, feature) if !(cfg = maincfg[feature]) raise ArgumentError, "#{feature} configuration not given." else cfg.each do |k,v| self[k] = v end end # Method method = self['Method'] if !method raise ArgumentError, "Method for #{feature} not given." end if !method? method raise ArgumentError, "Method #{method} for #{feature} not found." end # HomeDir dir = self['HomeDir'] ? self['HomeDir'] : feature.dup dir << '/' if dir[-1..-1]!='/' self['HomeDir'] = maincfg.setupDirInfo(dir) Dir.mkdir(self['HomeDir']) if !File.directory?(self['HomeDir']) # Dimensions self['Dimensions'] = self['Dimensions'] ? self['Dimensions'] : 1 # Meta-feature if self['Features'] self['BaseDir'] = maincfg['BaseDir'] end end |
Instance Method Details
#to_s ⇒ Object
97 98 99 |
# File 'lib/svmlab-config.rb', line 97 def to_s self.to_yaml end |