-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtest70_verbose.jl
63 lines (48 loc) · 1.93 KB
/
test70_verbose.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
module TestVerbosity
using ParallelKMeans
using StableRNGs
using Test
using Suppressor
@testset "LLoyd: Testing verbosity of implementation" begin
rng = StableRNG(2020)
X = rand(rng, 4, 150)
# Capture output and compare
r = @capture_out kmeans(Lloyd(), X, 3; n_threads=1, max_iters=1, verbose=true, rng = rng)
@test startswith(r, "Iteration 1: Jclust = 41.94858243")
end
@testset "Hamerly: Testing verbosity of implementation" begin
rng = StableRNG(2020)
X = rand(rng, 4, 150)
# Capture output and compare
r = @capture_out kmeans(Hamerly(), X, 3; n_threads=1, max_iters=1, verbose=true, rng = rng)
@test startswith(r, "Iteration 1: Jclust = 41.94858243")
end
@testset "Elkan: Testing verbosity of implementation" begin
rng = StableRNG(2020)
X = rand(rng, 4, 150)
# Capture output and compare
r = @capture_out kmeans(Elkan(), X, 3; n_threads=1, max_iters=1, verbose=true, rng = rng)
@test startswith(r, "Iteration 1: Jclust = 41.94858243")
end
@testset "Yinyang: Testing verbosity of implementation" begin
rng = StableRNG(2020)
X = rand(rng, 4, 150)
# Capture output and compare
r = @capture_out kmeans(Yinyang(), X, 3; n_threads=1, max_iters=1, verbose=true, rng = rng)
@test startswith(r, "Iteration 1: Jclust = 74.7253379541")
end
@testset "Coreset: Testing verbosity of implementation" begin
rng = StableRNG(2020)
X = rand(rng, 4, 150)
# Capture output and compare
r = @capture_out kmeans(Coreset(), X, 3; n_threads=1, max_iters=1, verbose=true, rng = rng)
@test startswith(r, "Iteration 1: Jclust = 32.8028409136")
end
@testset "MiniBatch: Testing verbosity of implementation" begin
rng = StableRNG(2020)
X = rand(rng, 3, 100)
# Capture output and compare
r = @capture_out kmeans(MiniBatch(10), X, 2; n_threads=1, max_iters=1, verbose=true, rng = rng)
@test startswith(r, "Iteration 1: Jclust = 18.298067523612104")
end
end # module