Closed
Conversation
* Add Wrapper interface for models wrappers * Add WrapperAware trait * Fix PhpDoc * Revert "Add WrapperAware trait" This reverts commit 241abc4. * Rename Wrapper interface to EstimatorWrapper * PHP CS fix
* add Swoole backend * phpstan: ignore swoole * feat: swoole process scheduler * fix(swoole): redo tasks when hash collision happens * chore(swoole): make sure coroutines are at the root of the scheduler * chore(swoole): set affinity / bind worker to a specific CPU core * chore(swoole): use igbinary if available * fix: remove comment * fix(swoole): worker cpu affinity * fix(swoole): cpu num * feat: scheduler improvements * style * chore(swoole): remove unnecessary atomics * chore(swoole): php backwards compatibility * fix: phpstan, socket message size * fix: uncomment test * style: composer fix
* Initial commit * Allow deltas in units tests
* add Swoole backend * phpstan: ignore swoole * feat: swoole process scheduler * fix(swoole): redo tasks when hash collision happens * chore(swoole): make sure coroutines are at the root of the scheduler * chore(swoole): set affinity / bind worker to a specific CPU core * chore(swoole): use igbinary if available * fix: remove comment * fix(swoole): worker cpu affinity * fix(swoole): cpu num * feat: scheduler improvements * style * chore(swoole): remove unnecessary atomics * chore(swoole): php backwards compatibility * fix: phpstan, socket message size * fix: uncomment test * style: composer fix * docs: Swoole backend
* chore: add NumPower to workflow pipeline. * chore: install openbla. * chore: install openblas from apt repo.
* Add is_finite checks to skip NAN values * Tests and fix issue with samples that are all non-finite
* Update stack * Update stack * fix ci.yml * fix ci.yml * fix ci.yml * fix phpstan * fix phpstan * fix phpstan * fix phpstan
* RubixML#355 Convert initializers to NumPower * fix naming * Change workflow * rubix numpower is added as dependency * fixes
…atures, num_samples]
…tropy loss function
392 convert layers to numpower
…-to-NumPower 394 convert misc nn classes to num power
There was a problem hiding this comment.
Pull request overview
This PR modernizes the codebase for PHP 8.4+/PHPUnit 12, addresses static-analysis findings, and introduces/reshapes several NeuralNet and backend components (including Swoole support).
Changes:
- Migrates tests to PHPUnit attributes, adds strict typing in multiple test files, and updates PHPUnit/PHPStan configs for newer toolchains.
- Refactors/extends core ML components (e.g., TF‑IDF param rename, NDArray/NumPower usage, new NeuralNet contracts/initializers/cost/activation functions).
- Adds Swoole backend testing/docs and adjusts extractors export behavior to append by default with optional overwrite.
Reviewed changes
Copilot reviewed 269 out of 580 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Backends/Tasks/TrainLearnerTest.php | Adds strict types, PHPUnit attributes, and named args in task test. |
| tests/Backends/Tasks/TrainAndValidateTest.php | Same modernization for TrainAndValidate task test. |
| tests/Backends/Tasks/ProbaTest.php | Same modernization for Proba task test. |
| tests/Backends/Tasks/PredictTest.php | Same modernization for Predict task test. |
| tests/Backends/SwooleTest.php | Adds Swoole backend integration test (skips if extension missing). |
| tests/Backends/SerialTest.php | Modernizes Serial backend test; switches to named args and typed property. |
| tests/Backends/AmpTest.php | Modernizes Amp backend test; switches to named args and typed property. |
| src/functions.php | Adds return type to iterator_first and throws on empty iterator. |
| src/constants.php | Bumps VERSION to major version ‘3’ and updates docblock. |
| src/Transformers/TfIdfTransformer.php | Renames dampening to sublinear and updates string output. |
| src/Transformers/MinMaxNormalizer.php | Ignores non-finite values during fit/transform/reverseTransform. |
| src/Transformers/MaxAbsoluteScaler.php | Ignores non-finite values when computing max abs. |
| src/Transformers/LambdaFunction.php | Adds mixed type for context param. |
| src/Transformers/IntervalDiscretizer.php | Encodes bin ordinal as base-26 string labels. |
| src/Transformers/ImageRotator.php | Fixes trailing comma in options array. |
| src/Transformers/BooleanConverter.php | Adds union types and enforces true/false values share the same type. |
| src/Traits/AssertsShapes.php | Introduces shared NDArray shape assertion for cost functions. |
| src/Strategies/Constant.php | Adds property/arg/return union types. |
| src/Specifications/SwooleExtensionIsLoaded.php | Adds specification for Swoole extension availability. |
| src/Specifications/SpecificationChain.php | Removes obsolete @throws annotation. |
| src/Serializers/RBX.php | Tightens checksum validation and changes version compatibility rules. |
| src/Regressors/SVR.php | Uses null-coalescing assignment; adds return type for predictSample. |
| src/Regressors/Ridge.php | Switches training/prediction math to NumPower/NDArray operations. |
| src/Regressors/RegressionTree.php | Adds return type for predictSample. |
| src/Regressors/RadiusNeighborsRegressor.php | Adds return type for predictSample. |
| src/Regressors/KNNRegressor.php | Adds return type for predictSample. |
| src/Regressors/KDNeighborsRegressor.php | Adds return type for predictSample. |
| src/Regressors/ExtraTreeRegressor.php | Adds return type for predictSample. |
| src/Regressors/Adaline.php | Adjusts Network return type and imports. |
| src/Pipeline.php | Adds mixed return type to __call. |
| src/PersistentModel.php | Uses null-coalescing assignment; adds mixed return type to __call. |
| src/NeuralNet/Snapshots/Snapshot.php | Adds internal snapshot utility for parametric layers. |
| src/NeuralNet/Parameters/Parameter.php | Adds NDArray parameter wrapper with optimizer-driven updates. |
| src/NeuralNet/Parameter.php | Adds void return type for __clone. |
| src/NeuralNet/Optimizers/Stochastic/Stochastic.php | Adds SGD optimizer implementation. |
| src/NeuralNet/Optimizers/Cyclical.php | Fixes typo in exception message text. |
| src/NeuralNet/Optimizers/Base/Optimizer.php | Introduces Optimizer interface for NDArray-based updates. |
| src/NeuralNet/Optimizers/Base/Adaptive.php | Adds Adaptive optimizer contract (warm cache). |
| src/NeuralNet/Networks/Base/Contracts/Network.php | Introduces internal NDArray-based Network contract. |
| src/NeuralNet/Network.php | Updates author tag (interface retained). |
| src/NeuralNet/Layers/Binary.php | Adds comment explaining BCE+sigmoid gradient simplification. |
| src/NeuralNet/Layers/Base/Contracts/Parametric.php | Adds parametric layer contract for snapshot/restore. |
| src/NeuralNet/Layers/Base/Contracts/Output.php | Adds Output layer contract with backprop hook. |
| src/NeuralNet/Layers/Base/Contracts/Layer.php | Adds base layer contract over NDArray. |
| src/NeuralNet/Layers/Base/Contracts/Input.php | Adds Input layer marker contract. |
| src/NeuralNet/Layers/Base/Contracts/Hidden.php | Adds Hidden layer contract with backprop hook. |
| src/NeuralNet/Initializers/Xavier/XavierUniform.php | Adds Xavier uniform initializer. |
| src/NeuralNet/Initializers/Xavier/XavierNormal.php | Adds Xavier normal initializer. |
| src/NeuralNet/Initializers/Uniform/Uniform.php | Adds Uniform initializer with beta validation. |
| src/NeuralNet/Initializers/Uniform/Exceptions/InvalidBetaException.php | Adds beta validation exception type. |
| src/NeuralNet/Initializers/Normal/TruncatedNormal.php | Adds truncated normal initializer with stdDev validation. |
| src/NeuralNet/Initializers/Normal/Normal.php | Adds normal initializer with stdDev validation. |
| src/NeuralNet/Initializers/Normal/Exceptions/InvalidStandardDeviationException.php | Adds stdDev validation exception type. |
| src/NeuralNet/Initializers/LeCun/LeCunUniform.php | Adds LeCun uniform initializer. |
| src/NeuralNet/Initializers/LeCun/LeCunNormal.php | Adds LeCun normal initializer. |
| src/NeuralNet/Initializers/He/HeUniform.php | Adds He uniform initializer. |
| src/NeuralNet/Initializers/He/HeNormal.php | Adds He normal initializer. |
| src/NeuralNet/Initializers/Constant/Constant.php | Adds constant initializer. |
| src/NeuralNet/Initializers/Base/Initializer.php | Adds initializer interface contract. |
| src/NeuralNet/Initializers/Base/Exceptions/InvalidFanOutException.php | Adds fan-out validation exception. |
| src/NeuralNet/Initializers/Base/Exceptions/InvalidFanInException.php | Adds fan-in validation exception. |
| src/NeuralNet/Initializers/Base/AbstractInitializer.php | Adds shared fan-in/out validation helper. |
| src/NeuralNet/CostFunctions/MeanAbsoluteError/MeanAbsoluteError.php | Adds MAE regression loss implementation. |
| src/NeuralNet/CostFunctions/LeastSquares/LeastSquares.php | Adds least squares regression loss implementation. |
| src/NeuralNet/CostFunctions/HuberLoss/Exceptions/InvalidAlphaException.php | Adds Huber alpha validation exception. |
| src/NeuralNet/CostFunctions/Base/Contracts/RegressionLoss.php | Adds regression loss contract type. |
| src/NeuralNet/CostFunctions/Base/Contracts/CostFunction.php | Adds common cost function interface. |
| src/NeuralNet/CostFunctions/Base/Contracts/ClassificationLoss.php | Adds classification loss contract type. |
| src/NeuralNet/ActivationFunctions/ThresholdedReLU/Exceptions/InvalidThresholdException.php | Adds threshold validation exception. |
| src/NeuralNet/ActivationFunctions/Softsign/Softsign.php | Adds Softsign activation. |
| src/NeuralNet/ActivationFunctions/Softplus/Softplus.php | Adds Softplus activation. |
| src/NeuralNet/ActivationFunctions/Sigmoid/Sigmoid.php | Adds Sigmoid activation using output-buffer derivative contract. |
| src/NeuralNet/ActivationFunctions/SiLU/SiLU.php | Adds SiLU activation. |
| src/NeuralNet/ActivationFunctions/ReLU6/ReLU6.php | Adds ReLU6 activation. |
| src/NeuralNet/ActivationFunctions/ReLU/ReLU.php | Adds ReLU activation. |
| src/NeuralNet/ActivationFunctions/LeakyReLU/Exceptions/InvalidLeakageException.php | Adds leakage validation exception. |
| src/NeuralNet/ActivationFunctions/HyperbolicTangent/HyperbolicTangent.php | Adds tanh activation. |
| src/NeuralNet/ActivationFunctions/HardSiLU/HardSiLU.php | Adds HardSiLU activation. |
| src/NeuralNet/ActivationFunctions/ELU/Exceptions/InvalidAlphaException.php | Adds ELU alpha validation exception. |
| src/NeuralNet/ActivationFunctions/Base/Contracts/OBufferDerivative.php | Adds output-buffer derivative contract. |
| src/NeuralNet/ActivationFunctions/Base/Contracts/IOBufferDerivative.php | Adds input/output-buffer derivative contract. |
| src/NeuralNet/ActivationFunctions/Base/Contracts/IBufferDerivative.php | Adds input-buffer derivative contract. |
| src/NeuralNet/ActivationFunctions/Base/Contracts/Derivative.php | Adds derivative marker interface. |
| src/NeuralNet/ActivationFunctions/Base/Contracts/ActivationFunction.php | Adds activation function contract. |
| src/Loggers/Screen.php | Accepts Stringable messages and casts before trim/echo. |
| src/Loggers/BlackHole.php | Accepts Stringable messages for PSR-3 compatibility. |
| src/Helpers/Stats.php | Refines return types and uses ??= in several methods. |
| src/Helpers/Params.php | Adds mixed type to toString input. |
| src/GridSearch.php | Adds mixed return type to __call. |
| src/Graph/Nodes/Split.php | Tightens value types and return types. |
| src/Graph/Nodes/Outcome.php | Adds explicit outcome return union type. |
| src/Graph/Nodes/Isolator.php | Tightens value types and return types. |
| src/Graph/Nodes/Depth.php | Removes obsolete @throws annotation. |
| src/Graph/Nodes/Box.php | Tightens value types and return types. |
| src/Graph/Nodes/Best.php | Removes obsolete @throws annotation. |
| src/Graph/Nodes/Average.php | Tightens outcome types and return types. |
| src/Extractors/NDJSON.php | Adds overwrite param; defaults to append behavior. |
| src/Extractors/Exporter.php | Updates interface to include overwrite parameter. |
| src/Extractors/CSV.php | Adds overwrite param; improves error messages; defaults to append. |
| src/Exceptions/ClassRevisionMismatch.php | Improves exception message clarity. |
| src/Deferred.php | Adds mixed return types to compute/__invoke. |
| src/Datasets/Unlabeled.php | Tightens splitByFeature value type union. |
| src/Datasets/Labeled.php | Adds label return type; tightens splitByFeature union. |
| src/Datasets/Dataset.php | Adds overwrite support for exportTo; tightens splitByFeature union. |
| src/DataType.php | Updates detect signature and removes resource handling branch. |
| src/CrossValidation/Metrics/Metric.php | Moves @internal annotation location in docblock. |
| src/CommitteeMachine.php | Adds runtime error when committee has no experts; return type for decideDiscrete. |
| src/Clusterers/MeanShift.php | Uses null-coalescing assignment for default kernel. |
| src/Classifiers/SoftmaxClassifier.php | Adjusts Network return type and imports. |
| src/Classifiers/SVC.php | Uses null-coalescing assignment for default kernel. |
| src/Classifiers/LogisticRegression.php | Adjusts Network return type and adds __unserialize workaround. |
| src/Classifiers/AdaBoost.php | Adjusts losses typing docs and uses nullsafe logger call. |
| src/BootstrapAggregator.php | Adds typed constants and improves phpdoc/typing around backend processing. |
| src/Backends/Tasks/TrainAndValidate.php | Adds explicit labels typing and uses named args for metric scoring. |
| src/Backends/Serial.php | Adds mixed typing for enqueue context. |
| src/Backends/Backend.php | Adds mixed typing for enqueue context in interface. |
| src/Backends/Amp.php | Uses ??= for workers; adds mixed typing for enqueue/coroutine context. |
| src/AnomalyDetectors/RobustZScore.php | Adds typed constant and cleans up epsilon/mad update logic. |
| src/AnomalyDetectors/OneClassSVM.php | Uses null-coalescing assignment for default kernel. |
| src/AnomalyDetectors/Loda.php | Tightens phpdoc return shapes and clarifies projections typing. |
| src/AnomalyDetectors/GaussianMLE.php | Adjusts epsilon/variance update logic similarly to RobustZScore. |
| phpunit.xml | Updates configuration for newer PHPUnit and reorganizes test suites. |
| phpstan.neon | Adds baseline include, sets PHP version to 8.4, and adjusts excludes. |
| docs/transformers/tf-idf-transformer.md | Updates docs for parameter rename and vectorizer references. |
| docs/transformers/regex-filter.md | Fixes/expands pattern table and adds EMOJIS preset entry. |
| docs/regressors/mlp-regressor.md | Updates parameters list and example to match new learner signature. |
| docs/regressors/gradient-boost.md | Adds evalInterval parameter and updates example call signature. |
| docs/neural-network/optimizers/stochastic.md | Updates optimizer namespace path and adds math section. |
| docs/neural-network/optimizers/step-decay.md | Updates optimizer namespace path and adds math section. |
| docs/neural-network/optimizers/rms-prop.md | Updates optimizer namespace path and adds math section. |
| docs/neural-network/optimizers/momentum.md | Updates optimizer namespace path and adds math section. |
| docs/neural-network/optimizers/cyclical.md | Updates optimizer namespace path and adds math section. |
| docs/neural-network/optimizers/adamax.md | Updates optimizer namespace path and adds math section. |
| docs/neural-network/optimizers/adam.md | Updates optimizer namespace path and adds math section. |
| docs/neural-network/optimizers/adagrad.md | Updates optimizer namespace path and adds math section. |
| docs/neural-network/hidden-layers/swish.md | Updates layer/initializer source links and namespaces. |
| docs/neural-network/hidden-layers/prelu.md | Updates layer/initializer source links and namespaces. |
| docs/neural-network/hidden-layers/placeholder1d.md | Adds Placeholder1D documentation page. |
| docs/neural-network/hidden-layers/noise.md | Updates layer source links and namespaces. |
| docs/neural-network/hidden-layers/dropout.md | Updates layer source links and namespaces. |
| docs/neural-network/hidden-layers/dense.md | Updates layer source links and namespaces. |
| docs/neural-network/hidden-layers/batch-norm.md | Updates layer/initializer namespaces. |
| docs/neural-network/hidden-layers/activation.md | Updates layer/activation namespaces. |
| docs/neural-network/cost-functions/relative-entropy.md | Updates cost function namespace in example. |
| docs/neural-network/cost-functions/mean-absolute-error.md | Adds MAE cost function documentation page. |
| docs/neural-network/cost-functions/least-squares.md | Updates cost function namespace in example. |
| docs/neural-network/cost-functions/huber-loss.md | Improves displayed math formatting. |
| docs/neural-network/cost-functions/cross-entropy.md | Updates cost function namespace in example. |
| docs/neural-network/activation-functions/thresholded-relu.md | Updates namespace, improves math, adds plots, tweaks example. |
| docs/neural-network/activation-functions/softsign.md | Updates namespace, adds plots, and reference formatting. |
| docs/neural-network/activation-functions/softplus.md | Adds Softplus activation documentation page. |
| docs/neural-network/activation-functions/softmax.md | Updates namespace, improves math, adds plots. |
| docs/neural-network/activation-functions/soft-plus.md | Removes legacy Soft Plus page (replaced by softplus.md). |
| docs/neural-network/activation-functions/silu.md | Updates namespace, improves math, adds plots. |
| docs/neural-network/activation-functions/sigmoid.md | Updates namespace and adds plots. |
| docs/neural-network/activation-functions/selu.md | Updates namespace, improves math, adds plots/references. |
| docs/neural-network/activation-functions/relu6.md | Adds ReLU6 activation documentation page. |
| docs/neural-network/activation-functions/relu.md | Updates namespace, improves math, adds plots/references. |
| docs/neural-network/activation-functions/leaky-relu.md | Updates namespace, improves math, adds plots/references. |
| docs/neural-network/activation-functions/hyperbolic-tangent.md | Updates namespace and adds plots. |
| docs/neural-network/activation-functions/hard-silu.md | Adds HardSiLU activation documentation page. |
| docs/neural-network/activation-functions/hard-sigmoid.md | Adds HardSigmoid activation documentation page. |
| docs/neural-network/activation-functions/gelu.md | Updates namespace and adds plots/math. |
| docs/neural-network/activation-functions/elu.md | Updates namespace, improves math, adds plots/references. |
| docs/installation.md | Updates stated PHP requirement. |
| docs/extractors/api.md | Documents overwrite vs append behavior for exporters. |
| docs/exploring-data.md | Updates exportTo usage/docs for overwrite behavior. |
| docs/datasets/api.md | Updates dataset exportTo signature/docs for overwrite behavior. |
| docs/classifiers/multilayer-perceptron.md | Updates parameters list and example signature. |
| docs/classifiers/logit-boost.md | Adds evalInterval parameter and updates example signature. |
| docs/backends/swoole.md | Adds Swoole backend documentation page. |
| composer.json | Raises PHP requirement, updates dev deps, adds NumPower extension requirement, adds phplint script. |
| benchmarks/Transformers/TSNEBench.php | Fixes benchmark docblock formatting. |
| benchmarks/Tokenizers/WordStemmerBench.php | Adds typed constants/properties and imports. |
| benchmarks/Tokenizers/WordBench.php | Adds typed constants/properties and imports. |
| benchmarks/Tokenizers/WhitespaceBench.php | Adds typed constants/properties and imports. |
| benchmarks/Tokenizers/SentenceBench.php | Adds typed constants/properties and imports. |
| benchmarks/Tokenizers/NGramBench.php | Adds typed constants/properties and imports. |
| benchmarks/Tokenizers/KSkipNGramBench.php | Adds typed constants/properties and imports. |
| benchmarks/Regressors/SVRBench.php | Adds typed constants/properties and imports. |
| benchmarks/Regressors/RidgeBench.php | Adds typed constants/properties and imports. |
| benchmarks/Regressors/RegressionTreeBench.php | Adds typed constants/properties and imports. |
| benchmarks/Regressors/RadiusNeighborsRegressorBench.php | Adds typed constants/properties and imports. |
| benchmarks/Regressors/MLPRegressorBench.php | Adds typed constants/properties and imports. |
| benchmarks/Regressors/KNNRegressorBench.php | Adds typed constants/properties and imports. |
| benchmarks/Regressors/KDNeighborsRegressorBench.php | Adds typed constants/properties and imports. |
| benchmarks/Regressors/GradientBoostBench.php | Adds typed constants/properties and imports. |
| benchmarks/Regressors/ExtraTreeRegressorBench.php | Adds typed constants/properties and imports. |
| benchmarks/Regressors/AdalineBench.php | Adds typed constants/properties and imports. |
| benchmarks/Graph/Trees/VantageTreeBench.php | Fixes benchmark docblock formatting. |
| benchmarks/Graph/Trees/KDTreeBench.php | Fixes benchmark docblock formatting. |
| benchmarks/Graph/Trees/BallTreeBench.php | Fixes benchmark docblock formatting. |
| benchmarks/Datasets/SplittingBench.php | Fixes benchmark docblock formatting. |
| benchmarks/Datasets/SortingBench.php | Fixes benchmark docblock formatting. |
| benchmarks/Datasets/RandomizationBench.php | Fixes benchmark docblock formatting. |
| benchmarks/Clusterers/MeanShiftBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/SoftmaxClassifierBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/SVCBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/RandomForestBench.php | Adds backend param providers and typed properties for benchmarking. |
| benchmarks/Classifiers/RadiusNeighborsBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/OneVsRestBench.php | Adds backend param providers and typed properties for benchmarking. |
| benchmarks/Classifiers/NaiveBayesBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/MultilayerPerceptronBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/LogitBoostBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/LogisticRegressionBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/KNearestNeighborsBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/KDNeighborsBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/GaussianNBBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/ExtraTreeClassifierBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/ClassificationTreeBench.php | Adds typed constants/properties and imports. |
| benchmarks/Classifiers/AdaBoostBench.php | Adds typed constants/properties and imports. |
| benchmarks/AnomalyDetectors/RobustZScoreBench.php | Adds typed constants/properties and imports. |
| benchmarks/AnomalyDetectors/OneClassSVMBench.php | Adds typed constants/properties and imports. |
| benchmarks/AnomalyDetectors/LodaBench.php | Adds typed constants/properties and imports. |
| benchmarks/AnomalyDetectors/LocalOutlierFactorBench.php | Adds typed constants/properties and imports. |
| benchmarks/AnomalyDetectors/IsolationForestBench.php | Adds typed constants/properties and imports. |
| benchmarks/AnomalyDetectors/GaussianMLEBench.php | Adds typed constants/properties and imports. |
| README.md | Updates stated PHP requirement. |
| CHANGELOG.md | Adds 3.0.0 entries and notes major breaking changes. |
| .phplint.yml | Adds phplint configuration. |
| .php-cs-fixer.dist.php | Updates fixer config, cache path, and finder exclusions. |
| .github/workflows/ci.yml | Updates CI matrix to PHP 8.4 and adds NumPower build/install steps. |
Comments suppressed due to low confidence (1)
src/DataType.php:1
- Image detection appears to have been removed from
DataType::detect()(the oldresource/gdbranch is gone). On PHP 8+, GD images are typicallyGdImageobjects, not resources—so without aninstanceof \\GdImagecheck inside theobjectbranch, images will be misclassified as OTHER and image support may regress (composer still suggestsext-gd). Consider restoring image detection for PHP 8+ by explicitly handling\\GdImageobjects.
<?php
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| use Rubix\ML\Specifications\SamplesAreCompatibleWithEstimator; | ||
| use Rubix\ML\Exceptions\InvalidArgumentException; | ||
| use Rubix\ML\Exceptions\RuntimeException; | ||
| use NumPower as nd; |
| */ | ||
| protected ?Vector $coefficients = null; | ||
|
|
||
| protected ?nd $coefficientsNd = null; |
| ->inverse() | ||
| ->dot($xT->dot($y)) | ||
| ->asArray(); | ||
| $this->coefficientsNd = nd::dot($xMulAddInv, $xtDotY); |
| ->add($this->bias) | ||
| ->asArray(); | ||
| $datasetNd = nd::array($dataset->samples()); | ||
| $datasetDotCoefficients = nd::dot($datasetNd, $this->coefficientsNd); |
|
|
||
| $header = JSON::decode($header); | ||
|
|
||
| if ($version <= 0 or $version > 2) { |
| * @return self | ||
| */ | ||
| public static function detect($value) : self | ||
| public static function detect(mixed $value) : self |
| * The loss at each epoch from the last training session. | ||
| * | ||
| * @var list<float>]|null | ||
| * @var list<float,int>|null |
| * Return the loss at each epoch of the last training session. | ||
| * | ||
| * @return float[]|null | ||
| * @return list<float,int>|null |
| ], | ||
| "require": { | ||
| "php": ">=7.4", | ||
| "php": ">=8.4", |
| * Xavier Uniform | ||
| * | ||
| * The Xavier 1 initializer draws from a uniform distribution [-limit, limit] | ||
| * where *limit* is squal to sqrt(6 / (fanIn + fanOut)). This initializer is |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.