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

Recursively check for Evaluate() in MOO #283

Merged
merged 10 commits into from
Apr 10, 2021
Merged

Conversation

jonpsy
Copy link
Member

@jonpsy jonpsy commented Apr 3, 2021

Refer #282 Section II.

Is there a strong reason for having template<MatType, FunctionType> instead of template<FunctionType, MatType>, the problem is when we do recursive call, I need the FunctionType to be the at the end for it to work. I don't see any other way.

Infact if we go by template<MatType, FunctionType>, I can integrate CheckMultiArbitraryFunctionTypeAPI() into CheckArbitraryFunctionTypeAPI(), and it will work like normal + MOO checks.

@jonpsy
Copy link
Member Author

jonpsy commented Apr 3, 2021

I think template specialization is the only way out of it. Thoughts? @zoq

@zoq
Copy link
Member

zoq commented Apr 4, 2021

I don't mind the solution, I think it's fine; it would also be fine for me to change the order, it's an internal function so we will not break anything. @rcurtin what do you think?

@jonpsy
Copy link
Member Author

jonpsy commented Apr 4, 2021

I found two solutions for the problem, one is:

 for(....)
{
    using FunctionType = typename std::tuple_element<
        I, std::tuple<ArbitraryFunctionType...>>::type;
    traits::CheckArbitraryFunctionTypeAPI<
        FunctionType, MatType>();
....
}

Inside Evaluate objectives(see nsga2_impl.hpp in current PR)

OR

Just take all the arguments, and keep the MatType as separate (as is implemented in the current PR).

jonpsy and others added 6 commits April 4, 2021 14:18
a) static_check (possibly wrong)
b) check Arbitrary in for loop in EvaluateObjectives
- doc change for MOO trait
@jonpsy
Copy link
Member Author

jonpsy commented Apr 4, 2021

  • Everything happens at compile time.
  • Uses the exact same interface.
  • Automagically handles a higher number of functions.

Perfect!

Side Note: Static Code Analysis is falling because "it can't find cmake". I don't think it has anything to do with the code itself (I may be wrong).

@zoq
Copy link
Member

zoq commented Apr 7, 2021

@mlpack-jenkins test this please

jonpsy and others added 2 commits April 7, 2021 09:01
Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
@jonpsy
Copy link
Member Author

jonpsy commented Apr 7, 2021

Trying this on NSGA2 is giving me some errors, I'll fix it and ping you back.

Note: The issue is fixed. Thanks to that error, the code is even better. ping: @zoq

@jonpsy jonpsy mentioned this pull request Apr 8, 2021
10 tasks
Copy link
Member

@zoq zoq left a comment

Choose a reason for hiding this comment

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

Would be nice if you could add a MMO function to:

https://github.com/mlpack/ensmallen/blob/master/tests/function_test.cpp

@zoq
Copy link
Member

zoq commented Apr 9, 2021

Would be nice if you could add a MMO function to:

https://github.com/mlpack/ensmallen/blob/master/tests/function_test.cpp

Nevermind, it's another test suite.

Copy link
Member

@zoq zoq left a comment

Choose a reason for hiding this comment

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

Looks great to me, thanks for putting this together 👍

@zoq
Copy link
Member

zoq commented Apr 9, 2021

@mlpack-jenkins test this please

@jonpsy
Copy link
Member Author

jonpsy commented Apr 9, 2021

@zoq I suppose I need to rebase ?

@zoq
Copy link
Member

zoq commented Apr 9, 2021

@zoq I suppose I need to rebase ?

No, I just like to see if the mlpack master build test works as expected.

Copy link

@mlpack-bot mlpack-bot bot left a comment

Choose a reason for hiding this comment

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

Second approval provided automatically after 24 hours. 👍

@jonpsy
Copy link
Member Author

jonpsy commented Apr 10, 2021

mlpack master build fails:

g.Component(0).Mean()[0] == Approx(0.5).epsilon(0.05)

FAILED:
  REQUIRE( g.Component(0).Mean()[0] == Approx(0.5).epsilon(0.05) )
with expansion:
  0.5299031563 == Approx( 0.5 )
at /home/jenkins/workspace/pull-requests-ensmallen-mlpack-build/mlpack/src/mlpack/tests/gmm_test.cpp:276

Is this expected?

@zoq
Copy link
Member

zoq commented Apr 10, 2021

mlpack master build fails:

g.Component(0).Mean()[0] == Approx(0.5).epsilon(0.05)

FAILED:
  REQUIRE( g.Component(0).Mean()[0] == Approx(0.5).epsilon(0.05) )
with expansion:
  0.5299031563 == Approx( 0.5 )
at /home/jenkins/workspace/pull-requests-ensmallen-mlpack-build/mlpack/src/mlpack/tests/gmm_test.cpp:276

Is this expected?

Some mlpack tests are non-deterministic, so they can fail sometimes, in most cases a simple threshold adjustment is all what is needed.

@zoq zoq merged commit 1b6c1d9 into mlpack:master Apr 10, 2021
@zoq
Copy link
Member

zoq commented Apr 10, 2021

Thanks again for the contribution.

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.

2 participants