|
1 | 1 | @testset "ProjectionPursuit" begin
|
2 |
| - N = 100_000 |
| 2 | + rng = MersenneTwister(42) |
| 3 | + N = 10_000 |
3 | 4 | a = [2randn(rng, N ÷ 2) .+ 6; randn(rng, N ÷ 2)]
|
4 | 5 | b = [3randn(rng, N ÷ 2); 2randn(rng, N ÷ 2)]
|
5 | 6 | c = randn(rng, N)
|
|
12 | 13 | @test Tables.columnnames(n) == (:a, :b, :c, :d)
|
13 | 14 |
|
14 | 15 | μ = 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 |
| - |
20 | 16 | Σ = 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)) |
37 | 19 |
|
38 | 20 | tₒ = revert(T, n, c)
|
39 | 21 |
|
|
54 | 36 | n, c = apply(T, t)
|
55 | 37 |
|
56 | 38 | μ = mean(Tables.matrix(n), dims=1)
|
57 |
| - @test isapprox(μ[1], 0; atol=1e-6) |
58 |
| - @test isapprox(μ[2], 0; atol=1e-6) |
59 | 39 | Σ = 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)) |
64 | 42 |
|
65 | 43 | tₒ = revert(T, n, c)
|
66 | 44 |
|
|
0 commit comments