Skip to content

Commit

Permalink
Base testing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed May 14, 2017
1 parent 588f785 commit f234d03
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions test/runtests.jl
Expand Up @@ -3,19 +3,22 @@ import SVR
currentdir = pwd()
cd(dirname(@__FILE__))

y_true = vec(readdlm("mg.result"))
@Base.Test.testset "SVR" begin

x, y = SVR.readlibsvmfile("mg.libsvm")
y_true = vec(readdlm("mg.result"))

pmodel = SVR.train(y, x');
y_pr = SVR.predict(pmodel, x');
@assert maximum(abs.(y_pr .- y_true)) < 1e-4
SVR.savemodel(pmodel, "mg.model")
SVR.freemodel(pmodel)
x, y = SVR.readlibsvmfile("mg.libsvm")

pmodel = SVR.loadmodel("mg.model")
y_pr = SVR.predict(pmodel, x');
# @assert maximum(abs.(y_pr .- y_true)) < 1e-4
SVR.freemodel(pmodel)
pmodel = SVR.train(y, x');
y_pr = SVR.predict(pmodel, x');
@Base.Test.test isapprox(maximum(abs.(y_pr .- y_true)), 0, atol=1e-4)
SVR.savemodel(pmodel, "mg.model")
SVR.freemodel(pmodel)

pmodel = SVR.loadmodel("mg.model")
y_pr = SVR.predict(pmodel, x');
# @assert maximum(abs.(y_pr .- y_true)) < 1e-4
SVR.freemodel(pmodel)
end

cd(currentdir)

0 comments on commit f234d03

Please sign in to comment.