lib/xlearn/model.rb in xlearn-0.1.4 vs lib/xlearn/model.rb in xlearn-0.1.5
- old
+ new
@@ -46,9 +46,11 @@
check_call FFI.XLearnFit(@handle, @model_file.path)
@model_path = @model_file.path
end
def predict(x, out_path: nil)
+ raise Error, "Not trained" unless @model_file
+
if x.is_a?(String)
check_call FFI.XLearnSetTest(@handle, x)
check_call FFI.XLearnSetBool(@handle, "from_file", true)
else
test_set = DMatrix.new(x)