-
-
Notifications
You must be signed in to change notification settings - Fork 193
Convert activation functions to numpower #381
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
Merged
SkibidiProduction
merged 119 commits into
3.0
from
convert-activation-functions-to-numpower
Aug 17, 2025
Merged
Changes from all commits
Commits
Show all changes
119 commits
Select commit
Hold shift + click to select a range
4f22784
first commit
SkibidiProduction 392e5ab
Basic implementation
SkibidiProduction 6a152f2
intermediate commit
SkibidiProduction 9d8c5ce
Merge branch 'refs/heads/3.0' into convert-activation-functions-to-nu…
SkibidiProduction 394c2a6
иbase changes
SkibidiProduction 479f851
base changes
SkibidiProduction e5151a5
Renamed inherited final method
apphp 6134448
Merge pull request #366 from apphp/SAM-1-fix-unit-tests-issues
SkibidiProduction c528e87
Refactored ELU class
apphp ac32b87
Added docker related files
apphp 0438747
Fixed error on implements base class
apphp af4f899
Typo fix in class name
apphp f44a597
Refactored ELUTest
apphp 7c7c999
Style fixes for ELU and ELUTest
apphp d405dbd
Style fixes for ELU and ELUTest
apphp f3371fe
Syntax fixes for ELUTest
apphp fab36f4
Syntax fixes for PHP8.4
apphp 9cfdba6
Improved configuration for PHP-CS-Fixer
apphp 1e6b857
Added PHP linter
apphp 797da3d
Improved configuration for PHP-CS-Fixer
apphp 3bb5166
Improved configuration for PHP-CS-Fixer
apphp cb4aa27
Improved configuration for phpstan
apphp 5a15240
Merge pull request #368 from apphp/SAM-3-add-phpinter-and-improve-stan
SkibidiProduction e95ed9c
Initial implementation of GeLU with test
apphp 58b0ca5
Added suppress for NDArray errors in ActivationFunctions
apphp 764647b
Added suppress for NDArray errors in ActivationFunctions
apphp 344a765
Removed named arguments from code
apphp 0caa2f2
Simplifyed
apphp 12ceaa4
Revert "Simplifyed"
apphp c4fc62e
Completed test for GeLU
apphp 9271ecb
Renamed interface name
apphp e1314b0
Changed style for tests according to phpunit v12
apphp 3d113a5
Removed comment
apphp 0dc6bcf
Merge pull request #369 from apphp/SAM-4-implementation-of-gelu-function
SkibidiProduction 13c9c40
Added hard sigmoid function
apphp 1120aee
Removed charts
apphp 0b80dc2
Added images for activation functions in docs
apphp 9e20e55
Extended info for Leaky ReLU
apphp 7851ffd
Extended info for ReLU
apphp 977a606
Added doc for ReLU6
apphp d5976d1
Extended info for SELU
apphp 62ea359
Extended info for Sigmoid
apphp 5272f21
Extended info for activation function docs
apphp ac5a359
Extended info for SiLU
apphp f517914
Extended info for Softmax
apphp 0a93aa1
Extended info for Softsign
apphp 6ce5406
Extended info for Softplus
apphp 31f646b
Extended info for thresholded relu
apphp 90e4495
Typo fixes
apphp 18817d2
Typo fixes
apphp 4b796ce
Typo fixes
apphp 81ccd8c
Merge pull request #370 from apphp/SAM-4-refactor-hard-sigmoid-function
SkibidiProduction 0a30675
Merge pull request #371 from apphp/SAM-5-add-charts-for-activation-fu…
SkibidiProduction 86be3a7
Fixes for Latex formulas
apphp 1b3d739
Merge pull request #372 from apphp/SAM-5-add-charts-for-activation-fu…
SkibidiProduction 06bd4fc
Implemented HardSiLU
apphp fcfc9e4
Typo fix for GELU
apphp 0052750
Code style fixes
apphp 4b438ac
Ignored errors moved to phpstan-baseline.neon
apphp 56ca6e3
Fixed pow() precision for GELU
apphp 2a5012b
Replace assertEqual with assertEqualsWithDelta
apphp 619b7d0
Fixed pow() precision for GELU
apphp 854433a
Merge pull request #373 from apphp/SAM-6-hard-silu
SkibidiProduction 451dd2a
SAM-7 added HyperbolicTangent
apphp 868830b
SAM-7 fix for function docblock
apphp 43fb507
Fix for merge issues
apphp e16b4a4
SAM-8 implemented LeakyReLU
apphp c3f6530
SAM-8 style fixes for import classes
apphp 287ec5f
SAM-8 changed LeakyReLUTest initial values
apphp eef5c57
SAM-8 typo fixes
apphp cd980ea
SAM-8 typo fixes
apphp d80916e
SAM-7 turned back function signature in docblock
apphp 0025293
SAM-8 turned back function signature in docblock
apphp 45361aa
SAM-8 fixed parameter name like in interface
apphp 31a6e10
SAM-7 fixed parameter name like in interface
apphp 2872f1f
Merge pull request #374 from apphp/SAM-7-HyperbolicTangent
SkibidiProduction eb864c2
Renamed parameter name like in interface
apphp 5203c0a
SAM-7 differentiate parameter renamed
apphp ed71ea5
Refactoring Derivative sub-interfaces
apphp b0ce0ff
Refactoring ELU with IOBufferDerivative
apphp c84319e
Refactoring GELU with IBufferDerivative
apphp de4ef87
Refactoring HardSigmoid with IBufferDerivative
apphp 6dd013f
Refactoring HardSigmoid with IBufferDerivative
apphp 6020364
Refactoring HardSigmoid with IBufferDerivative
apphp e278894
Refactoring HardSiLU with IBufferDerivative
apphp 87cb3b9
Refactoring HyperbolicTangent with IBufferDerivative
apphp edb02d0
Refactoring LeakyReLU with IBufferDerivative
apphp 6c4d9f4
Typo fix in exception text
apphp 39cb8a0
Merge pull request #375 from apphp/SAM-8-
SkibidiProduction fac54d0
Refactoring ReLU with IBufferDerivative
apphp 2c2af8a
Style fixes
apphp 6239d26
Refactoring ReLU6 with IBufferDerivative
apphp fc7f11e
Style fixes
apphp be0b9ff
Merge pull request #376 from apphp/SAM-9-ReLU-and-ReLU6
SkibidiProduction 2bbfd3c
References fix
apphp 5c2adf7
Refactoring SELU with IBufferDerivative
apphp 7b0479a
Refactoring Sigmoid with OBufferDerivative
apphp 9119f26
Merge pull request #377 from apphp/SAM-10-SELU
SkibidiProduction 62f7af1
Init Refactoring SiLU with IBufferDerivative
apphp 7b220c6
Refactoring SiLU with IBufferDerivative
apphp d05d9bf
code style fixes
apphp a8c311b
Refactoring multiply function
apphp c777bc0
Code optimization
apphp 512719f
Code optimization
apphp 5a1d2c4
Merge pull request #378 from apphp/SAM-11-SiLU
SkibidiProduction ed7610c
Replaced plots for Softmax function
apphp e02bfe5
Refactoring Softmax with OBufferDerivative
apphp dda3c71
Added more examples for Softmax
apphp 4dd363e
Code cleanup for ActivationFunction
apphp 32087ae
Update documentation for activation functions
apphp 99a4ccd
Refactoring Softplus with IBufferDerivative
apphp 8992e18
Merge pull request #379 from apphp/Sam-12-softmax-function
SkibidiProduction e6a6143
Refactoring Softsign with IBufferDerivative
apphp 1cbad5c
Refactoring ThresholdedReLU with IBufferDerivative
apphp 9e4a6b2
Merge pull request #380 from apphp/SAM-13-softsign
SkibidiProduction cc48e95
Removed unneeded comment
apphp 6a57850
Removed unneeded comments
apphp ca0612d
Removed 'Size and Performance' section from docs
apphp c52161a
Merge pull request #382 from apphp/pr-381-fix-comments
apphp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
path: ./ | ||
jobs: 10 | ||
cache-dir: runtime/.phplint.cache/ | ||
extensions: | ||
- php | ||
exclude: | ||
- vendor/ | ||
- runtime/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
<span style="float:right;"><a href="https://github.com/RubixML/ML/blob/master/src/NeuralNet/ActivationFunctions/ELU.php">[source]</a></span> | ||
<span style="float:right;"><a href="https://github.com/RubixML/ML/blob/master/src/NeuralNet/ActivationFunctions/ELU/ELU.php">[source]</a></span> | ||
|
||
# ELU | ||
*Exponential Linear Units* are a type of rectifier that soften the transition from non-activated to activated using the exponential function. As such, ELU produces smoother gradients than the piecewise linear [ReLU](relu.md) function. | ||
|
||
$$ | ||
{\displaystyle ELU = {\begin{cases}\alpha \left(e^{x}-1\right)&{\text{if }}x\leq 0\\x&{\text{if }}x>0\end{cases}}} | ||
\text{ELU}(x) = | ||
\begin{cases} | ||
SkibidiProduction marked this conversation as resolved.
Show resolved
Hide resolved
|
||
\alpha \left(e^{x}-1\right) & \text{if } x \leq 0 \\ | ||
x & \text{if } x > 0 | ||
\end{cases} | ||
$$ | ||
|
||
## Parameters | ||
| # | Name | Default | Type | Description | | ||
|---|---|---|---|---| | ||
| 1 | alpha | 1.0 | float | The value at which leakage will begin to saturate. Ex. alpha = 1.0 means that the output will never be less than -1.0 when inactivated. | | ||
|
||
## Plots | ||
<img src="../../images/activation-functions/elu.png" alt="ELU Function" width="500" height="auto"> | ||
|
||
<img src="../../images/activation-functions/elu-derivative.png" alt="ELU Derivative" width="500" height="auto"> | ||
|
||
## Example | ||
```php | ||
use Rubix\ML\NeuralNet\ActivationFunctions\ELU; | ||
use Rubix\ML\NeuralNet\ActivationFunctions\ELU\ELU; | ||
|
||
$activationFunction = new ELU(2.5); | ||
``` | ||
|
||
## References | ||
[^1]: D. A. Clevert et al. (2016). Fast and Accurate Deep Network Learning by Exponential Linear Units. | ||
[1]: D. A. Clevert et al. (2016). Fast and Accurate Deep Network Learning by Exponential Linear Units. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<span style="float:right;"><a href="https://github.com/RubixML/ML/blob/master/src/NeuralNet/ActivationFunctions/HardSigmoid/HardSigmoid.php">[source]</a></span> | ||
|
||
# Hard Sigmoid | ||
A piecewise linear approximation of the sigmoid function that is computationally more efficient. The Hard Sigmoid function has an output value between 0 and 1, making it useful for binary classification problems. | ||
|
||
$$ | ||
\text{HardSigmoid}(x) = \max\left(0,\min\left(1, 0.2x + 0.5\right)\right) | ||
$$ | ||
|
||
## Parameters | ||
This activation function does not have any parameters. | ||
|
||
## Plots | ||
<img src="../../images/activation-functions/hard-sigmoid.png" alt="Hard Sigmoid Function" width="500" height="auto"> | ||
|
||
<img src="../../images/activation-functions/hard-sigmoid-derivative.png" alt="Hard Sigmoid Derivative" width="500" height="auto"> | ||
|
||
## Example | ||
```php | ||
use Rubix\ML\NeuralNet\ActivationFunctions\HardSigmoid\HardSigmoid; | ||
|
||
$activationFunction = new HardSigmoid(); | ||
``` | ||
|
||
## References | ||
[1]: https://en.wikipedia.org/wiki/Hard_sigmoid |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.