Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed Oct 31, 2016
1 parent 108cab7 commit 8c6fb84
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions test/tst_loss.jl
Expand Up @@ -331,6 +331,11 @@ end

_logitdistloss(y, t) = -log((4*exp(t-y))/(1+exp(t-y))^2)
test_value(LogitDistLoss(), _logitdistloss, yr, tr)

function _quantileloss(y, t)
(y - t) * (0.7 - (y - t < 0))
end
test_value(QuantileLoss(.7), _quantileloss, yr, tr)
end

@testset "Test other loss against reference function" begin
Expand Down
29 changes: 28 additions & 1 deletion test/tst_properties.jl
Expand Up @@ -317,6 +317,34 @@ end
@test issymmetric(loss) == true
end

@testset "QuantileLoss" begin
l1 = QuantileLoss(.5)
l2 = QuantileLoss(.7)

@test issymmetric(l1) == true
@test issymmetric(l2) == false

@test isminimizable(l2) == true

@test isdifferentiable(l2) == false
@test isdifferentiable(l2, 0) == false
@test isdifferentiable(l2, 1) == true
@test istwicedifferentiable(l2) == false
@test istwicedifferentiable(l2, 0) == false
@test istwicedifferentiable(l2, 1) == true

@test isstronglyconvex(l2) == false
@test isstrictlyconvex(l2) == false
@test isconvex(l2) == true

# @test isnemitski(l2) == ?
@test islipschitzcont(l2) == true
@test islocallylipschitzcont(l2) == true
# @test isclipable(l2) == ?
@test ismarginbased(l2) == false
@test isdistancebased(l2) == true
end

# --------------------------------------------------------------

@testset "ZeroOneLoss" begin
Expand Down Expand Up @@ -563,4 +591,3 @@ end
end
end
end

0 comments on commit 8c6fb84

Please sign in to comment.