Skip to content

Conversation

@rcurtin
Copy link
Member

@rcurtin rcurtin commented May 8, 2024

I noticed that the tests for LARS were failing more than once every hundred trials with different random seeds, so I started digging in to see what was wrong. I came out with a few conclusions:

  • With float as an element type, the PredictTest can be more flaky---this is expected due to less precision. So now it allows multiple trials when the element type is float.

  • When a singularity is encountered, we try to remove the most-recently-added variable from the active set. However, the activeGramMatrix was not removing its columns correctly.

  • When computing the signs of correlations, if the correlation was exactly 0, then there was a division by 0. I fixed that just by adding a small value to the denominator.

  • The check to see if an externally-passed Gram matrix satisfied the expected conditions of mean-centeredness and unit-variance was more trouble than it was worth, and I think the note in the documentation is good enough. So I removed the check, since it does not seem to be reliable.

Then, I ran [LARSTest] 1000 times with different random seeds and encountered no failures, so, hopefully this should help with test robustness.

Comment on lines -11 to -14

// Note: We don't use BOOST_REQUIRE_CLOSE in the code below because we need
// to use FPC_WEAK, and it's not at all intuitive how to do that.

Copy link
Member

Choose a reason for hiding this comment

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

Nice catch

typedef typename MatType::elem_type ElemType;

const ElemType tol = (std::is_same<ElemType, double>::value) ? 1e-5 : 1e-3;
const ElemType tol = (std::is_same<ElemType, double>::value) ? 1e-5 : 5e-3;
Copy link
Member

Choose a reason for hiding this comment

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

This is a nice way to make the usage of std::is_same in a condition with out the need for constexpr

@conradsnicta conradsnicta merged commit e851d03 into mlpack:master May 15, 2024
This was referenced May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants