Skip to content

Commit

Permalink
Yg/rank 1 fail test (#22)
Browse files Browse the repository at this point in the history
* update gsvd pkg

* update test delete rank-1 test case

* Update Project.toml

* test threshhold

---------

Co-authored-by: youdongguo <[email protected]>
  • Loading branch information
youdongguo and youdongguo authored Aug 26, 2024
1 parent 1bc8306 commit b5d7b47
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,15 @@ H_GT = [6 10 8 2 0 1 2 10;
4 9 10 7 7 0 0 0
]

@testset "test top wrapper" begin
@testset "test top wrapper" begin
W = W_GT[:, 3:4]
H = H_GT[3:4, :]
X = W*H
standard_nmf = nnmf(float(X), 1; init=:nndsvd, tol=1e-12, initdata = svd(float(X)))
result_renmf = nmfmerge(float(X), 2=>1; alg = :cd, maxiter = 10^5, tol_final=1e-12, tol_intermediate = 1e-12);
W_standard, H_standard = standard_nmf.W, standard_nmf.H
result_renmf = nmfmerge(float(X), 3=>2; alg = :cd, maxiter = 10^5, tol_final=1e-12, tol_intermediate = 1e-12);
W_renmf, H_renmf = result_renmf.W, result_renmf.H
W_standard, H_standard = colnormalize(W_standard, H_standard)
W_renmf, H_renmf = colnormalize(W_renmf, H_renmf)
@test sum(abs2, W_standard - W_renmf) <= 1e-12
@test sum(abs2, H_standard - H_renmf) <= 1e-12

@test size(W_renmf, 2) == 2
@test size(H_renmf, 1) == 2
@test sum(abs2, X - W_renmf*H_renmf) <= 1e-12

standard_nmf = nnmf(float(X), 2; init=:nndsvd, tol=1e-12, initdata=svd(float(X)))
result_renmf = nmfmerge(float(X), 2=>2; alg=:cd, maxiter=10^5, tol_final=1e-12, tol_intermediate=1e-12)
Expand Down

0 comments on commit b5d7b47

Please sign in to comment.