Skip to content

Commit

Permalink
Tests: make external initialization deterministic (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored Jan 26, 2023
1 parent e2139ac commit e319cd8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/initialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
@test all(W2 .== W)
@test all(H2 .== zero(T))

Random.seed!(5678)
W1, H1 = NMF.nndsvd(X, 5);
F = svd(X)
W2, H2 = NMF.nndsvd(X, 5; initdata=F)
@test norm(X - W2*H2) < norm(X - W1*H1)
W1, H1 = NMF.nndsvd(X, 5; initdata=F)
F = svd(2X)
W2, H2 = NMF.nndsvd(2X, 5; initdata=F)
@test W2 sqrt(T(2)) * W1 && H2 sqrt(T(2)) * H1

W, H = NMF.nndsvd(X, 5; variant=:ar)
@test all(W .> zero(T))
Expand Down

0 comments on commit e319cd8

Please sign in to comment.