Skip to content

Adding hard shrink function#2186

Merged
birm merged 27 commits intomlpack:masterfrom
ojhalakshya:Adding-Hard-Shrink-Function
Mar 8, 2020
Merged

Adding hard shrink function#2186
birm merged 27 commits intomlpack:masterfrom
ojhalakshya:Adding-Hard-Shrink-Function

Conversation

@ojhalakshya
Copy link
Copy Markdown
Contributor

Hi, everyone I wanted to add the Hard Shrink Activation Function.
It can be refrenced from pytorch.
Just to mention ideal soft shrinkage has
lower minmax bound risk for small n but ideal hard shrinkage has lower minmax bound risk for large n.

Copy link
Copy Markdown
Member

@kartikdutt18 kartikdutt18 left a comment

Choose a reason for hiding this comment

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

Nice, I think this looks okay. I will take a closer look tomorrow.

@ojhalakshya
Copy link
Copy Markdown
Contributor Author

Hi @zoq I have also tried to keep this up to the format that you had asked me for my previous pr.
If you get a chance please have a look and kindly suggest any changes that I need to make.
Thanks.

@zoq
Copy link
Copy Markdown
Member

zoq commented Feb 12, 2020

Hi @zoq I have also tried to keep this up to the format that you had asked me for my previous pr.
If you get a chance please have a look and kindly suggest any changes that I need to make.
Thanks.

If you can implement the function in the form of another layer, that would be great. https://github.com/mlpack/mlpack/blob/master/src/mlpack/methods/ann/layer/elu.hpp is one example.

@ojhalakshya
Copy link
Copy Markdown
Contributor Author

XD Forgot to push the code. Doing it now.

@kartikdutt18
Copy link
Copy Markdown
Member

No worries.

Copy link
Copy Markdown
Member

@kartikdutt18 kartikdutt18 left a comment

Choose a reason for hiding this comment

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

Hi @ojhalakshya, thanks for all the work, I have left some comments, other than that I think it's fine. Thanks.

Copy link
Copy Markdown
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.

If you can fix the minor issue, it's ready from my side.

/**
* Create HardShrink object using specified hyperparameter lambda.
*
* @param lambda is calculated by multiplying the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Picky style comment, the first word after the parameter should use upper casing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

* @param lambda Is calculated by multiplying the
Is this the correct way to do so?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That looks good, yes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the quick reply.
I have done the changes as above.

@zoq
Copy link
Copy Markdown
Member

zoq commented Feb 25, 2020

Also, let's wait for the test results before we merge this in, just to make sure we didn't miss anything.

@ojhalakshya
Copy link
Copy Markdown
Contributor Author

@zoq
sure no problem.
Thanks.

@ojhalakshya
Copy link
Copy Markdown
Contributor Author

@zoq
How to resolve the appveyor build fail?
I think all other tests have passed successfully.
Thanks.

Copy link
Copy Markdown

@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. 👍

@mlpack-bot
Copy link
Copy Markdown

mlpack-bot bot commented Mar 3, 2020

Hello there! Thanks for your contribution. I see that this is your first contribution to mlpack. If you'd like to add your name to the list of contributors in src/mlpack/core.hpp and COPYRIGHT.txt and you haven't already, please feel free to push a change to this PR---or, if it gets merged before you can, feel free to open another PR.

In addition, if you'd like some stickers to put on your laptop, I'd be happy to help get them in the mail for you. Just send an email with your physical mailing address to stickers@mlpack.org, and then one of the mlpack maintainers will put some stickers in an envelope for you. It may take a few weeks to get them, depending on your location. 👍

@birm
Copy link
Copy Markdown
Member

birm commented Mar 3, 2020

@ojhalakshya does everything look to merge, or do you want to make any more revisions?

@zoq
Copy link
Copy Markdown
Member

zoq commented Mar 3, 2020

@zoq
How to resolve the appveyor build fail?
I think all other tests have passed successfully.
Thanks.

The appveyor timed-out, it's not related with the changes from the PR, so save to ignore.

@kartikdutt18
Copy link
Copy Markdown
Member

@ojhalakshya, Thanks for the changes. This looks fine to me too. 👍

@ojhalakshya ojhalakshya requested a review from zoq March 7, 2020 19:47
@birm birm merged commit 0d8c3a0 into mlpack:master Mar 8, 2020
ojhalakshya added a commit to ojhalakshya/mlpack that referenced this pull request Mar 10, 2020
* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
ojhalakshya added a commit to ojhalakshya/mlpack that referenced this pull request Mar 10, 2020
* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
ojhalakshya added a commit to ojhalakshya/mlpack that referenced this pull request Mar 11, 2020
* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
ojhalakshya added a commit to ojhalakshya/mlpack that referenced this pull request Mar 11, 2020
* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
ojhalakshya added a commit to ojhalakshya/mlpack that referenced this pull request Mar 14, 2020
* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>
ojhalakshya added a commit to ojhalakshya/mlpack that referenced this pull request Mar 14, 2020
* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

dummy commit

Redirected link on NUMfocus logo

test bugs fixing

rebasing branch
ojhalakshya added a commit to ojhalakshya/mlpack that referenced this pull request Mar 16, 2020
* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

dummy commit

Redirected link on NUMfocus logo

test bugs fixing

rebasing branch
ojhalakshya added a commit to ojhalakshya/mlpack that referenced this pull request Mar 17, 2020
* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

dummy commit

Redirected link on NUMfocus logo

test bugs fixing

rebasing branch
ojhalakshya added a commit to ojhalakshya/mlpack that referenced this pull request Mar 17, 2020
* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

dummy commit

Redirected link on NUMfocus logo

test bugs fixing

rebasing branch

dummy commit

dummy commit 2
birm pushed a commit that referenced this pull request Mar 18, 2020
* Adding hard shrink function (#2186)

* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

* completed hardshrink_function.hpp

* resetting master

* complete hardsrhink_function.hpp

* activation_functions_test.cpp

* cmake changes

* base layer changes

* style correction

* starting implementing hard shrink as layer

* new changes

* changes in tests

* inv changes

* test changes

* test changes

* deleting prev function

* test style changes

* more style changes

* comment changes

* minor changes

* comment corrections hard shrink

* minor changes

* dummy commit

* Style fix for parameter lambda

* hardshrink.hpp to hardshrink_impl.hpp fn function shift

* style fix

Co-authored-by: Marcus Edel <marcus.edel@fu-berlin.de>

dummy commit

Redirected link on NUMfocus logo

test bugs fixing

rebasing branch

* rvalue refactor corrections

edited copyright.txt

changes in History.md

bug fix

* bug fixes

minor change

* dummy commit

* style fix
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.

4 participants