Class: SVM::Parameter
- Inherits:
-
Object
- Object
- SVM::Parameter
- Defined in:
- lib/libsvm/parameter.rb
Instance Attribute Summary collapse
-
#param ⇒ Object
Returns the value of attribute param.
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(*args) ⇒ Parameter
constructor
A new instance of Parameter.
- #method_missing(m, *args) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Parameter
Returns a new instance of Parameter.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/libsvm/parameter.rb', line 5 def initialize(*args) @param = Svm_parameter.new @param.svm_type = C_SVC @param.kernel_type = RBF @param.degree = 3 @param.gamma = 0 # 1/k @param.coef0 = 0 @param.nu = 0.5 @param.cache_size = 100 @param.C = 1 @param.eps = 1e-3 @param.p = 0.1 @param.shrinking = 1 @param.nr_weight = 0 #@param.weight_label = _int_array([]) #@param.weight = _double_array([]) @param.probability = 0 args[0].each {|k,v| self.send("#{k}=",v) } if !args[0].nil? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/libsvm/parameter.rb', line 28 def method_missing(m, *args) if m.to_s == 'weight_label=' @weight_label_len = args[0].size pargs = _int_array(args[0]) _free_int_array(@param.weight_label) elsif m.to_s == 'weight=' @weight_len = args[0].size pargs = _double_array(args[0]) _free_double_array(@param.weight) else pargs = args[0] end if m.to_s.index('=') @param.send("#{m}",pargs) else @param.send("#{m}") end end |
Instance Attribute Details
#param ⇒ Object
Returns the value of attribute param.
3 4 5 |
# File 'lib/libsvm/parameter.rb', line 3 def param @param end |
Instance Method Details
#destroy ⇒ Object
49 50 51 52 53 54 |
# File 'lib/libsvm/parameter.rb', line 49 def destroy _free_int_array(@param.weight_label) _free_double_array(@param.weight) #delete_svm_parameter(@param) @param = nil end |