Skip to content
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

Fix LMNN termination condition #4188

Merged
merged 5 commits into from Mar 1, 2018
Merged

Conversation

vinx13
Copy link
Member

@vinx13 vinx13 commented Feb 27, 2018

No description provided.

@karlnapf
Copy link
Member

Don't we have some unit tests to cover this?
Something like. Asserts that residuals match requires tolerance on termination?

@karlnapf
Copy link
Member

Otherwise fine from my side.
Integration tests should soon be back so then we can compare using that

@vinx13
Copy link
Member Author

vinx13 commented Feb 27, 2018

@karlnapf This is not covered by unit tests, i think we can check the number of iterations.

@karlnapf
Copy link
Member

Yeah would be good to add something in these lines to this PR

@vinx13
Copy link
Member Author

vinx13 commented Feb 27, 2018

Added a tests. We need to fix trace first (#4176 ) to pass the test.

@karlnapf
Copy link
Member

Great!

@@ -62,6 +62,57 @@ TEST(LMNN,train_identity_init)
SG_UNREF(lmnn)
}

TEST(LMNN, train_termination)
{
// create features, each column is a feature vector
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you remove all these superfluous comments?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, does this test share code with other tests? If so it should be pulled out and shared

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code that creates features and labels could be shared with other tests, but this could make it difficult to modify test input. shall we do this refactor?


// check number of iterations
auto stat = lmnn->get_statistics();
EXPECT_EQ(stat->obj.vlen, 1234);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1234?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I'm testing against Matlab prototype here https://github.com/iglesias/lmnn-gsoc2013-review

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

// check number of iterations
auto stat = lmnn->get_statistics();
EXPECT_EQ(stat->obj.vlen, 1234);
SG_UNREF(lmnn)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use some, then you don't need to unref

@karlnapf
Copy link
Member

Once the tests pass this can be merged

@karlnapf
Copy link
Member

karlnapf commented Mar 1, 2018

🎉

@karlnapf karlnapf merged commit 7cbf15e into shogun-toolbox:develop Mar 1, 2018
@@ -292,6 +292,7 @@ bool CLMNNImpl::check_termination(float64_t stepsize, const SGVector<float64_t>

if (iter >= 10)
{
obj_threshold *= obj[iter - 1];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch @vinx13, thanks a lot for fixing.

ktiefe pushed a commit to ktiefe/shogun that referenced this pull request Jul 30, 2019
* Fix LMNN termination condition
* Add unit tests on lmnn termination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants