Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 for CMA-ES inconsistencies. #193
Fix for CMA-ES inconsistencies. #193
Changes from 17 commits
f428f71
c0a5f28
1e848fd
2e503f1
93146c5
1edbfe7
7de865b
659d0c6
748bbd4
9ad2852
8d7598c
63aed56
77a89ca
881de8a
2ec0daa
c5bebd6
89fe19c
2b86192
838e47c
486930a
bd793ed
04ab903
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Either camelcase the variable names or say
lower bound
.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.
I think it's still valid to apply the lower/upper bound here.
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.
Hi, @zoq so should I remove the boundary transformation from here and implement it like it was before like here. Thanks
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 I dived into the code and I think it makes sense to introduce another policy e.g.
TransformationPolicy
so we can enable/disable the boundary constraint. Let me know what you think, I can push the changes to you branch, if you like?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.
Hi, @zoq thanks for the review. I will try and implement the
TransformationPolicy
this week. Can you point to some source code to which I can refer before implementing this? Thank you.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 basically it's similar to how the update policies are implemented https://github.com/mlpack/ensmallen/tree/master/include/ensmallen_bits/sgd/update_policies.
We basically add a new template type called
TransformationPolicy
or something like that and define an interface. I think we just need two functions at this pointTransform
andInverse
. So the class policy class for theBoundaryBoxConstraint
could look like:we also a policy class that does nothing:
in the
CMAES
class we can than use an instantiation of theTransformationPolicy
and call theTransform
andInverse
methods. Hopefully what I wrote above makes sense, happy to clarify anything.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.
Do you think we should make t possible to define bounds for all coordinates similar to what has been done for the PSO method:
ensmallen/include/ensmallen_bits/pso/pso.hpp
Lines 91 to 92 in 70a2be8
It uses a 1x1 matrix as a default, so the current implementation but you use a matrix of the same size as the coordinates as well. Let me know what you think. We can also implement the change another time and merge this as is.
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.
Hi @zoq, I implemented this boundary handing function after referring the N Hansen's implementation and in my opinion, I think we should merge this as it is and if there are any issues in the future I will try to change this accordingly. Thanks.
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.
Okay, fine for me.
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.
Shouldn't this be
y += (ElemType)(r * (1 + (int)(xlow - y) / r));
also is the cast toElemType
needed, not sure I can see the reason to do that?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.
Hi, @zoq sorry for replying so late. I did it to ensure that every element of the matrix are of same types if not required I'll remove it. Thanks.
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.
If you don't mind let's remove the extra cast.
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.
Should we add a test that makes sure CMAES keeps the answers within the given bounds?
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.
Hi, @favre49 sorry for being late on this. Can you please elaborate on the test for this should be written? Should I consider an armadillo matrix which is out of bounds and then apply the transformation to see if the values are within the specified range? Sorry, that I didn't get the gist of what you were saying.
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.
I meant we should add a test that ensures the optimized coordinates are within the given bounds [-20,20]. Something like
REQUIRE(coordinates[i] <=20 && coordinates[i] >= -20)
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.
Hi, @favre49 the test has been added kindly have a look whenever you get a chance. Thanks.