spec/model_spec.rb in rb-libsvm-1.0.11 vs spec/model_spec.rb in rb-libsvm-1.1.0
- old
+ new
@@ -19,10 +19,11 @@
def create_parameter
parameter = SvmParameter.new
parameter.cache_size = 50 # mb
parameter.eps = 0.01
parameter.c = 10
+ parameter.probability = 1
parameter
end
end
@@ -89,7 +90,14 @@
end
it "can predict" do
prediction = @model.predict(create_example)
prediction.should_not be_nil
+ end
+
+ it "can predict probability" do
+ prediction, probabilities = @model.predict_probability(create_example)
+ prediction.should_not be_nil
+ probabilities.should have(@model.classes).items
+ probabilities.each { |e| e.should_not be_nil }
end
end