diff --git a/test/tst_loss.jl b/test/tst_loss.jl index f62395f..b77980a 100644 --- a/test/tst_loss.jl +++ b/test/tst_loss.jl @@ -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 diff --git a/test/tst_properties.jl b/test/tst_properties.jl index 330b430..beecdda 100644 --- a/test/tst_properties.jl +++ b/test/tst_properties.jl @@ -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 @@ -563,4 +591,3 @@ end end end end -