396 convert regressors to num power#411
Conversation
# Conflicts: # src/NeuralNet/Networks/FeedForward/FeedForward.php # tests/NeuralNet/Layers/Swish/SwishTest.php # tests/NeuralNet/Networks/NetworkTest.php
| @@ -0,0 +1,58 @@ | |||
| <?php | |||
|
|
|||
| namespace Rubix\ML\Benchmarks\NeuralNet\ActivationFunctions\ELU; | |||
There was a problem hiding this comment.
Let's change the path of this file to reflect it's namespace i.e. remove the ELU folder.
| @@ -0,0 +1,58 @@ | |||
| <?php | |||
|
|
|||
| namespace Rubix\ML\Benchmarks\NeuralNet\ActivationFunctions\GELU; | |||
There was a problem hiding this comment.
The same comment to ELU applies to each of these benchmark files.
| * @var Matrix | ||
| */ | ||
| protected $z; | ||
| protected Matrix $z; |
There was a problem hiding this comment.
Since we are swapping Tensor out for NumPower, we won't need these old benchmarks.
| // New samples start with provisional label 0 in this partial batch, | ||
| // so size bookkeeping must include them before any reassignments. | ||
| $this->sizes[0] += $dataset->numSamples(); | ||
|
|
There was a problem hiding this comment.
Why are we making edits to K Means as part of this?
| * | ||
| * Cloning an NDArray directly may trigger native memory corruption in some | ||
| * NumPower builds (e.g. heap corruption/segfaults when parameters are | ||
| * snapshotted during training). To make cloning deterministic and stable we |
| $this->network = new FeedForward( | ||
| new Placeholder1D($dataset->numFeatures()), | ||
| [new Dense(1, $this->l2Penalty, true, new Xavier2())], | ||
| [new Dense(1, $this->l2Penalty, true, new XavierUniform())], |
There was a problem hiding this comment.
Why are we renaming this class? Will it cause a BC break?
| ?RegressionLoss $costFn = null, | ||
| ?Metric $metric = null | ||
| ?Metric $metric = null, | ||
| bool $packSamples = false |
There was a problem hiding this comment.
Why are we adding this as a constructor argument? Can we autodetect if we need to pack the array instead?
| foreach ($distances as $distance) { | ||
| $weights[] = 1.0 / (1.0 + $distance); | ||
| } | ||
| $distances = NumPower::array($distances); |
There was a problem hiding this comment.
Let's not convert this file to NumPower. It will not benefit as much as others and requires an extra dependency.
| * @package Rubix/ML | ||
| * @author Andrew DalPino | ||
| * @author Samuel Akopyan <leumas.a@gmail.com> | ||
| */ |
There was a problem hiding this comment.
Let's remove all these @author annotations (including mine). They will become meaningless as time goes on and we can use Git blame if necessary. If the purpose is for recognition, there are probably better ways we can go about it.
There was a problem hiding this comment.
Actually on second thought, let's do that in a follow up commit. All good!
| - | ||
| message: '#^Property Rubix\\ML\\Classifiers\\NaiveBayes\:\:\$counts \(array<string, list<array<int<0, max>>>>\) does not accept non\-empty\-array<array<array<int<0, max>>>>\.$#' | ||
| identifier: assign.propertyType | ||
| count: 1 |
There was a problem hiding this comment.
What is the reason for not using the same phpstan configuration for both local dev and CI?
| 'float64', | ||
| 'int8', | ||
| 'int16', | ||
| 'int32', |
There was a problem hiding this comment.
Why do we need these constants?
| @@ -19,8 +19,8 @@ parameters: | |||
| path: src/NeuralNet/Networks/FeedForward/FeedForward.php | |||
|
|
|||
| - | |||
There was a problem hiding this comment.
What's the reason for this config?
| @@ -11,6 +11,10 @@ | |||
| use Rubix\ML\Exceptions\RuntimeException; | |||
| use PHPUnit\Framework\TestCase; | |||
There was a problem hiding this comment.
Why are we changing this file as part of this PR?
| @@ -6,18 +6,20 @@ | |||
|
|
|||
| use PHPUnit\Framework\Attributes\CoversClass; | |||
| use PHPUnit\Framework\Attributes\Group; | |||
There was a problem hiding this comment.
Why are we changing this file as part of this PR?
andrewdalpino
left a comment
There was a problem hiding this comment.
Hey @apphp, it looks like there are alot of changes here that don't really have much to do with converting the Regressors to NumPower. Let's revert any changes that aren't necessary to complete the task at hand and we can follower up with other changes in separate PRs.
# Conflicts: # benchmarks/NeuralNet/ActivationFunctions/ELUBench.php # benchmarks/NeuralNet/ActivationFunctions/GELUBench.php # phpstan-baseline.neon # phpstan-ci.neon # src/NeuralNet/ActivationFunctions/Softmax/Softmax.php # src/NeuralNet/Initializers/Normal/Normal.php # src/NeuralNet/Initializers/Uniform/Uniform.php # src/NeuralNet/Layers/Noise/Noise.php # src/NeuralNet/Networks/FeedForward/FeedForward.php # src/NeuralNet/Parameters/Parameter.php # tests/NeuralNet/CostFunctions/CrossEntropy/CrossEntropyTest.php # tests/NeuralNet/CostFunctions/LeastSquares/LeastSquaresTest.php # tests/NeuralNet/Initializers/HeUniformTest.php # tests/NeuralNet/Initializers/Normal/NormalTest.php # tests/NeuralNet/Initializers/TruncatedNormalTest.php # tests/NeuralNet/Initializers/XavierNormalTest.php # tests/NeuralNet/Initializers/XavierUniformTest.php
No description provided.