@@ -16,7 +16,7 @@ def initialize(arg1,arg2=nil)
16
16
end
17
17
msg = svm_check_parameter ( prob . prob , param . param )
18
18
raise ::ArgumentError , msg if msg
19
- @model = svm_train ( prob . prob , param . param )
19
+ @model = svm_train ( prob . prob , param . param )
20
20
end
21
21
22
22
#setup some classwide variables
@@ -29,11 +29,10 @@ def initialize(arg1,arg2=nil)
29
29
delete_int ( intarr )
30
30
#check if valid probability model
31
31
@probability = svm_check_probability_model ( @model )
32
-
33
32
end
34
33
35
- def predict ( x )
36
- data = SVM . convert_to_svm_node_array ( x )
34
+ def predict ( x , max = x . max )
35
+ data = SVM . convert_to_svm_node_array ( x , max )
37
36
ret = svm_predict ( @model , data )
38
37
svm_node_array_destroy ( data )
39
38
return ret
@@ -54,7 +53,7 @@ def get_labels
54
53
def predict_values_raw ( x )
55
54
#convert x into svm_node, allocate a double array for return
56
55
n = ( @nr_class *( @nr_class -1 ) /2 ) . floor
57
- data = _convert_to_svm_node_array ( x )
56
+ data = SVM . convert_to_svm_node_array ( x )
58
57
dblarr = new_double ( n )
59
58
svm_predict_values ( @model , data , dblarr )
60
59
ret = _double_array_to_list ( dblarr , n )
@@ -101,7 +100,7 @@ def predict_probability(x)
101
100
end
102
101
103
102
#convert x into svm_node, alloc a double array to receive probabilities
104
- data = _convert_to_svm_node_array ( x )
103
+ data = SVM . convert_to_svm_node_array ( x )
105
104
dblarr = new_double ( @nr_class )
106
105
pred = svm_predict_probability ( @model , data , dblarr )
107
106
pv = _double_array_to_list ( dblarr , @nr_class )
0 commit comments