-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing edge cases and adding tests for them
Also re-arranged tests so that if ever we port this code to StatsBase then we take over only the tests in test/corkendall, Testing against corkendall_naive probably too complicated...
- Loading branch information
Showing
7 changed files
with
119 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
using KendallTau | ||
using Test | ||
|
||
include("corkendall_naive.jl") | ||
include("compare_implementations.jl") | ||
|
||
|
||
include("corkendall.jl") | ||
include("corkendall_fromfile.jl") | ||
include("corkendall_fromfile.jl") | ||
include("versus_naive.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using KendallTau | ||
using Test | ||
using Random | ||
|
||
#= | ||
Note that corkendall and corkendall_naive share some subroutines, notably handle_pairwise | ||
and handle_listwise. If those were bugged then this test would likely give a false positive. | ||
=# | ||
|
||
@testset "versus_corkendall_naive" begin | ||
|
||
@test compare_implementations(corkendall, corkendall_naive, abstol=0.0, maxcols=10, maxrows=10, numtests=200) == true | ||
@test compare_implementations(corkendall, corkendall_naive, abstol=0.0, maxcols=10, maxrows=100, numtests=200) == true | ||
@test compare_implementations(corkendall, corkendall_naive, abstol=1e14, maxcols=2, maxrows=20000, numtests=5) == true | ||
|
||
smallx = randn(MersenneTwister(123), 1000, 3) | ||
indicators = rand(MersenneTwister(456), 1000, 3) .< 0.05 | ||
smallx = ifelse.(indicators, missing, smallx) | ||
@test corkendall_naive(smallx, skipmissing=:pairwise) == KendallTau.corkendall(smallx, skipmissing=:pairwise) | ||
@test corkendall_naive(smallx, skipmissing=:listwise) == KendallTau.corkendall(smallx, skipmissing=:listwise) | ||
@test isequal(corkendall_naive(smallx, skipmissing=:none) , KendallTau.corkendall(smallx, skipmissing=:none)) | ||
|
||
|
||
end |