-
Notifications
You must be signed in to change notification settings - Fork 24
NMFCross seeding random #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
0f6abea
25a974b
1872654
77e296b
3c1c404
db9d180
553fb7b
72433bb
a81c954
63d4b15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,35 @@ | ||||||
| #define CATCH_CONFIG_MAIN | ||||||
| #include <catch2/catch_all.hpp> | ||||||
| #include <flucoma/algorithms/public/NMFCross.hpp> | ||||||
| #include <flucoma/data/FluidTensor.hpp> | ||||||
| #include <algorithm> | ||||||
| #include <iostream> | ||||||
| #include <vector> | ||||||
|
|
||||||
| TEST_CASE("NMFCross is repeatable with user-supplied random seed") | ||||||
| { | ||||||
|
|
||||||
| using fluid::algorithm::NMFCross; | ||||||
| using Tensor = fluid::FluidTensor<double, 2>; | ||||||
| NMFCross algo; | ||||||
|
|
||||||
| Tensor targetMag{{0.5, 0.4}, {0.1, 1.1}, {0.7, 0.8}, {0.3, 0.0}, {1.0, 0.9}, {0.2, 0.6}}; | ||||||
| Tensor sourceMag{{0.0, 0.4}, {0.6, 0.7}, {0.8, 0.1}, {1.0, 0.5}, {1.1, 0.2}, {0.9, 0.3}}; | ||||||
|
|
||||||
| std::vector Hs(3, Tensor(5, 2)); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Algo is getting numFrames from the length of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With those changes, the tests pass for me. Locally, rerun cmake with |
||||||
|
|
||||||
| algo.process(targetMag, Hs[0], sourceMag, 3, 2, 7, 42); | ||||||
| algo.process(targetMag, Hs[1], sourceMag, 3, 2, 7, 42); | ||||||
| algo.process(targetMag, Hs[2], sourceMag, 3, 2, 7, 5063); | ||||||
|
|
||||||
| using Catch::Matchers::RangeEquals; | ||||||
|
|
||||||
| SECTION("Calls with the same seed have the same output") | ||||||
| { | ||||||
| REQUIRE_THAT(Hs[1], RangeEquals(Hs[0])); | ||||||
| } | ||||||
| SECTION("Calls with different seeds have different outputs") | ||||||
| { | ||||||
| REQUIRE_THAT(Hs[1], !RangeEquals(Hs[2])); | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the algo is created at each call, with the number of iterations as a constructor variable?