Class: SVMModel

Inherits:
VectorModel show all
Defined in:
lib/rbbt/vector/model/svm.rb

Instance Attribute Summary

Attributes inherited from VectorModel

#directory, #eval_model, #extract_features, #features, #labels, #model_file, #train_model

Instance Method Summary collapse

Methods inherited from VectorModel

R_eval, R_train, #add, #cross_validation, #eval, #eval_list, #train

Constructor Details

#initialize(dir) ⇒ SVMModel

Returns a new instance of SVMModel.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rbbt/vector/model/svm.rb', line 3

def initialize(dir)
  super(dir)

  @extract_features = Proc.new{|element|
    element
  }

  @train_model =<<-EOF
library(e1071);
model = svm(class ~ ., data = features);
  EOF
 
  @eval_model =<<-EOF
library(e1071);
label = predict(model, features);
  EOF
end