Skip to content

Commit 7a3e85d

Browse files
committed
Update projectionpursuit tests
1 parent 381e61f commit 7a3e85d

File tree

4 files changed

+6
-28
lines changed

4 files changed

+6
-28
lines changed

test/data/projectionpursuit-1.png

-94.2 KB
Loading

test/data/projectionpursuit-2.png

-141 KB
Loading

test/data/projectionpursuit-3.png

5.85 KB
Loading

test/transforms/projectionpursuit.jl

+6-28
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@testset "ProjectionPursuit" begin
2-
N = 100_000
2+
rng = MersenneTwister(42)
3+
N = 10_000
34
a = [2randn(rng, N ÷ 2) .+ 6; randn(rng, N ÷ 2)]
45
b = [3randn(rng, N ÷ 2); 2randn(rng, N ÷ 2)]
56
c = randn(rng, N)
@@ -12,28 +13,9 @@
1213
@test Tables.columnnames(n) == (:a, :b, :c, :d)
1314

1415
μ = mean(Tables.matrix(n), dims=1)
15-
@test isapprox(μ[1], 0; atol=1e-4)
16-
@test isapprox(μ[2], 0; atol=1e-4)
17-
@test isapprox(μ[3], 0; atol=1e-4)
18-
@test isapprox(μ[4], 0; atol=1e-4)
19-
2016
Σ = cov(Tables.matrix(n))
21-
@test isapprox(Σ[1, 2], 0; atol=1e-3)
22-
@test isapprox(Σ[1, 3], 0; atol=1e-3)
23-
@test isapprox(Σ[1, 4], 0; atol=1e-3)
24-
@test isapprox(Σ[2, 1], 0; atol=1e-3)
25-
@test isapprox(Σ[2, 3], 0; atol=1e-3)
26-
@test isapprox(Σ[2, 4], 0; atol=1e-3)
27-
@test isapprox(Σ[3, 1], 0; atol=1e-3)
28-
@test isapprox(Σ[3, 2], 0; atol=1e-3)
29-
@test isapprox(Σ[3, 4], 0; atol=1e-3)
30-
@test isapprox(Σ[4, 1], 0; atol=1e-3)
31-
@test isapprox(Σ[4, 2], 0; atol=1e-3)
32-
@test isapprox(Σ[4, 3], 0; atol=1e-3)
33-
@test isapprox(Σ[1, 1], 1; atol=1e-2)
34-
@test isapprox(Σ[2, 2], 1; atol=1e-2)
35-
@test isapprox(Σ[3, 3], 1; atol=1e-2)
36-
@test isapprox(Σ[4, 4], 1; atol=1e-2)
17+
@test all(isapprox.(μ, 0, atol=1e-8))
18+
@test all(isapprox.(Σ, I(4), atol=1e-8))
3719

3820
tₒ = revert(T, n, c)
3921

@@ -54,13 +36,9 @@
5436
n, c = apply(T, t)
5537

5638
μ = mean(Tables.matrix(n), dims=1)
57-
@test isapprox(μ[1], 0; atol=1e-6)
58-
@test isapprox(μ[2], 0; atol=1e-6)
5939
Σ = cov(Tables.matrix(n))
60-
@test isapprox(Σ[1, 1], 1; atol=1e-6)
61-
@test isapprox(Σ[1, 2], 0; atol=1e-6)
62-
@test isapprox(Σ[2, 1], 0; atol=1e-6)
63-
@test isapprox(Σ[2, 2], 1; atol=1e-6)
40+
@test all(isapprox.(μ, 0, atol=1e-8))
41+
@test all(isapprox.(Σ, I(2), atol=1e-8))
6442

6543
tₒ = revert(T, n, c)
6644

0 commit comments

Comments
 (0)