From 7e262ffbc00c1e035c84bbf3020a4001ba2cadfc Mon Sep 17 00:00:00 2001 From: Ronan Giron Date: Tue, 16 Jan 2024 17:54:12 +0100 Subject: [PATCH 1/6] Add Wrapper interface for models wrappers --- src/GridSearch.php | 2 +- src/PersistentModel.php | 2 +- src/Pipeline.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GridSearch.php b/src/GridSearch.php index 42ab7f3a3..72bc5c64d 100644 --- a/src/GridSearch.php +++ b/src/GridSearch.php @@ -39,7 +39,7 @@ * @package Rubix/ML * @author Andrew DalPino */ -class GridSearch implements Estimator, Learner, Parallel, Verbose, Persistable +class GridSearch implements Wrapper, Learner, Parallel, Verbose, Persistable { use AutotrackRevisions, Multiprocessing, LoggerAware; diff --git a/src/PersistentModel.php b/src/PersistentModel.php index a7964a8a7..195216ba7 100644 --- a/src/PersistentModel.php +++ b/src/PersistentModel.php @@ -21,7 +21,7 @@ * @package Rubix/ML * @author Andrew DalPino */ -class PersistentModel implements Estimator, Learner, Probabilistic, Scoring +class PersistentModel implements Wrapper, Learner, Probabilistic, Scoring { /** * The persistable base learner. diff --git a/src/Pipeline.php b/src/Pipeline.php index 7a04e080c..06185fd11 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -25,7 +25,7 @@ * @package Rubix/ML * @author Andrew DalPino */ -class Pipeline implements Online, Probabilistic, Scoring, Persistable +class Pipeline implements Online, Probabilistic, Scoring, Persistable, Wrapper { use AutotrackRevisions; From 241abc4317eec701211b7a88a17a1b610c366dfe Mon Sep 17 00:00:00 2001 From: Ronan Giron Date: Tue, 16 Jan 2024 18:07:35 +0100 Subject: [PATCH 2/6] Add WrapperAware trait --- src/GridSearch.php | 44 +--------------------- src/PersistentModel.php | 53 +-------------------------- src/Pipeline.php | 44 +--------------------- src/Traits/WrapperAware.php | 73 +++++++++++++++++++++++++++++++++++++ src/Wrapper.php | 20 ++++++++++ 5 files changed, 99 insertions(+), 135 deletions(-) create mode 100644 src/Traits/WrapperAware.php create mode 100644 src/Wrapper.php diff --git a/src/GridSearch.php b/src/GridSearch.php index 72bc5c64d..58df48c0f 100644 --- a/src/GridSearch.php +++ b/src/GridSearch.php @@ -23,6 +23,7 @@ use Rubix\ML\Specifications\EstimatorIsCompatibleWithMetric; use Rubix\ML\Specifications\SamplesAreCompatibleWithEstimator; use Rubix\ML\Exceptions\InvalidArgumentException; +use Rubix\ML\Traits\WrapperAware; /** * Grid Search @@ -41,7 +42,7 @@ */ class GridSearch implements Wrapper, Learner, Parallel, Verbose, Persistable { - use AutotrackRevisions, Multiprocessing, LoggerAware; + use AutotrackRevisions, Multiprocessing, LoggerAware, WrapperAware; /** * The class name of the base estimator. @@ -71,13 +72,6 @@ class GridSearch implements Wrapper, Learner, Parallel, Verbose, Persistable */ protected \Rubix\ML\CrossValidation\Validator $validator; - /** - * The base estimator instance. - * - * @var Learner - */ - protected \Rubix\ML\Learner $base; - /** * The validation scores obtained from the last search. * @@ -179,18 +173,6 @@ public function __construct( $this->backend = new Serial(); } - /** - * Return the estimator type. - * - * @internal - * - * @return EstimatorType - */ - public function type() : EstimatorType - { - return $this->base->type(); - } - /** * Return the data types that the estimator is compatible with. * @@ -232,16 +214,6 @@ public function trained() : bool return $this->base->trained(); } - /** - * Return the base learner instance. - * - * @return Estimator - */ - public function base() : Estimator - { - return $this->base; - } - /** * Train one estimator per combination of parameters given by the grid and * assign the best one as the base estimator of this instance. @@ -304,18 +276,6 @@ public function train(Dataset $dataset) : void } } - /** - * Make a prediction on a given sample dataset. - * - * @param Dataset $dataset - * @throws Exceptions\RuntimeException - * @return mixed[] - */ - public function predict(Dataset $dataset) : array - { - return $this->base->predict($dataset); - } - /** * The callback that executes after the cross validation task. * diff --git a/src/PersistentModel.php b/src/PersistentModel.php index 195216ba7..68a61cdc2 100644 --- a/src/PersistentModel.php +++ b/src/PersistentModel.php @@ -10,6 +10,7 @@ use Rubix\ML\AnomalyDetectors\Scoring; use Rubix\ML\Exceptions\InvalidArgumentException; use Rubix\ML\Exceptions\RuntimeException; +use Rubix\ML\Traits\WrapperAware; /** * Persistent Model @@ -23,12 +24,7 @@ */ class PersistentModel implements Wrapper, Learner, Probabilistic, Scoring { - /** - * The persistable base learner. - * - * @var Learner - */ - protected \Rubix\ML\Learner $base; + use WrapperAware; /** * The persister used to interface with the storage layer. @@ -84,30 +80,6 @@ public function __construct(Learner $base, Persister $persister, ?Serializer $se $this->serializer = $serializer ?? new RBX(); } - /** - * Return the estimator type. - * - * @internal - * - * @return EstimatorType - */ - public function type() : EstimatorType - { - return $this->base->type(); - } - - /** - * Return the data types that the estimator is compatible with. - * - * @internal - * - * @return list<\Rubix\ML\DataType> - */ - public function compatibility() : array - { - return $this->base->compatibility(); - } - /** * Return the settings of the hyper-parameters in an associative array. * @@ -134,16 +106,6 @@ public function trained() : bool return $this->base->trained(); } - /** - * Return the base estimator instance. - * - * @return Estimator - */ - public function base() : Estimator - { - return $this->base; - } - /** * Save the model to storage. */ @@ -168,17 +130,6 @@ public function train(Dataset $dataset) : void $this->base->train($dataset); } - /** - * Make a prediction on a given sample dataset. - * - * @param Dataset $dataset - * @return mixed[] - */ - public function predict(Dataset $dataset) : array - { - return $this->base->predict($dataset); - } - /** * Estimate the joint probabilities for each possible outcome. * diff --git a/src/Pipeline.php b/src/Pipeline.php index 06185fd11..8df11bafa 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -4,6 +4,7 @@ use Rubix\ML\Helpers\Params; use Rubix\ML\Datasets\Dataset; +use Rubix\ML\Traits\WrapperAware; use Rubix\ML\Transformers\Elastic; use Rubix\ML\Transformers\Stateful; use Rubix\ML\Transformers\Transformer; @@ -27,7 +28,7 @@ */ class Pipeline implements Online, Probabilistic, Scoring, Persistable, Wrapper { - use AutotrackRevisions; + use AutotrackRevisions, WrapperAware; /** * A list of transformers to be applied in series. @@ -38,13 +39,6 @@ class Pipeline implements Online, Probabilistic, Scoring, Persistable, Wrapper // ]; - /** - * An instance of a base estimator to receive the transformed data. - * - * @var Estimator - */ - protected \Rubix\ML\Estimator $base; - /** * Should we update the elastic transformers during partial train? * @@ -72,30 +66,6 @@ public function __construct(array $transformers, Estimator $base, bool $elastic $this->elastic = $elastic; } - /** - * Return the estimator type. - * - * @internal - * - * @return EstimatorType - */ - public function type() : EstimatorType - { - return $this->base->type(); - } - - /** - * Return the data types that the estimator is compatible with. - * - * @internal - * - * @return list<\Rubix\ML\DataType> - */ - public function compatibility() : array - { - return $this->base->compatibility(); - } - /** * Return the settings of the hyper-parameters in an associative array. * @@ -124,16 +94,6 @@ public function trained() : bool : true; } - /** - * Return the base estimator instance. - * - * @return Estimator - */ - public function base() : Estimator - { - return $this->base; - } - /** * Run the training dataset through all transformers in order and use the * transformed dataset to train the estimator. diff --git a/src/Traits/WrapperAware.php b/src/Traits/WrapperAware.php new file mode 100644 index 000000000..6c9009e65 --- /dev/null +++ b/src/Traits/WrapperAware.php @@ -0,0 +1,73 @@ +base; + } + + /** + * Return the estimator type. + * + * @internal + * + * @return EstimatorType + */ + public function type() : EstimatorType + { + return $this->base->type(); + } + + /** + * Return the data types that the estimator is compatible with. + * + * @internal + * + * @return list<\Rubix\ML\DataType> + */ + public function compatibility() : array + { + return $this->base->compatibility(); + } + + /** + * Make a prediction on a given sample dataset. + * + * @param Dataset $dataset + * @throws RuntimeException + * @return mixed[] + */ + public function predict(Dataset $dataset) : array + { + return $this->base->predict($dataset); + } +} \ No newline at end of file diff --git a/src/Wrapper.php b/src/Wrapper.php new file mode 100644 index 000000000..9406a722b --- /dev/null +++ b/src/Wrapper.php @@ -0,0 +1,20 @@ + Date: Tue, 16 Jan 2024 18:16:10 +0100 Subject: [PATCH 3/6] Fix PhpDoc --- src/Traits/WrapperAware.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Traits/WrapperAware.php b/src/Traits/WrapperAware.php index 6c9009e65..1edb41640 100644 --- a/src/Traits/WrapperAware.php +++ b/src/Traits/WrapperAware.php @@ -21,7 +21,7 @@ trait WrapperAware /** * The base estimator. * - * @var Learner + * @var Estimator */ protected Estimator $base; From c0d8bf6ad7b08a3d8284b38320d5e91b5b40a116 Mon Sep 17 00:00:00 2001 From: Ronan Giron Date: Wed, 17 Jan 2024 09:22:37 +0100 Subject: [PATCH 4/6] Revert "Add WrapperAware trait" This reverts commit 241abc4317eec701211b7a88a17a1b610c366dfe. --- src/GridSearch.php | 44 +++++++++++++++++++++- src/PersistentModel.php | 53 ++++++++++++++++++++++++++- src/Pipeline.php | 44 +++++++++++++++++++++- src/Traits/WrapperAware.php | 73 ------------------------------------- 4 files changed, 135 insertions(+), 79 deletions(-) delete mode 100644 src/Traits/WrapperAware.php diff --git a/src/GridSearch.php b/src/GridSearch.php index 58df48c0f..72bc5c64d 100644 --- a/src/GridSearch.php +++ b/src/GridSearch.php @@ -23,7 +23,6 @@ use Rubix\ML\Specifications\EstimatorIsCompatibleWithMetric; use Rubix\ML\Specifications\SamplesAreCompatibleWithEstimator; use Rubix\ML\Exceptions\InvalidArgumentException; -use Rubix\ML\Traits\WrapperAware; /** * Grid Search @@ -42,7 +41,7 @@ */ class GridSearch implements Wrapper, Learner, Parallel, Verbose, Persistable { - use AutotrackRevisions, Multiprocessing, LoggerAware, WrapperAware; + use AutotrackRevisions, Multiprocessing, LoggerAware; /** * The class name of the base estimator. @@ -72,6 +71,13 @@ class GridSearch implements Wrapper, Learner, Parallel, Verbose, Persistable */ protected \Rubix\ML\CrossValidation\Validator $validator; + /** + * The base estimator instance. + * + * @var Learner + */ + protected \Rubix\ML\Learner $base; + /** * The validation scores obtained from the last search. * @@ -173,6 +179,18 @@ public function __construct( $this->backend = new Serial(); } + /** + * Return the estimator type. + * + * @internal + * + * @return EstimatorType + */ + public function type() : EstimatorType + { + return $this->base->type(); + } + /** * Return the data types that the estimator is compatible with. * @@ -214,6 +232,16 @@ public function trained() : bool return $this->base->trained(); } + /** + * Return the base learner instance. + * + * @return Estimator + */ + public function base() : Estimator + { + return $this->base; + } + /** * Train one estimator per combination of parameters given by the grid and * assign the best one as the base estimator of this instance. @@ -276,6 +304,18 @@ public function train(Dataset $dataset) : void } } + /** + * Make a prediction on a given sample dataset. + * + * @param Dataset $dataset + * @throws Exceptions\RuntimeException + * @return mixed[] + */ + public function predict(Dataset $dataset) : array + { + return $this->base->predict($dataset); + } + /** * The callback that executes after the cross validation task. * diff --git a/src/PersistentModel.php b/src/PersistentModel.php index 68a61cdc2..195216ba7 100644 --- a/src/PersistentModel.php +++ b/src/PersistentModel.php @@ -10,7 +10,6 @@ use Rubix\ML\AnomalyDetectors\Scoring; use Rubix\ML\Exceptions\InvalidArgumentException; use Rubix\ML\Exceptions\RuntimeException; -use Rubix\ML\Traits\WrapperAware; /** * Persistent Model @@ -24,7 +23,12 @@ */ class PersistentModel implements Wrapper, Learner, Probabilistic, Scoring { - use WrapperAware; + /** + * The persistable base learner. + * + * @var Learner + */ + protected \Rubix\ML\Learner $base; /** * The persister used to interface with the storage layer. @@ -80,6 +84,30 @@ public function __construct(Learner $base, Persister $persister, ?Serializer $se $this->serializer = $serializer ?? new RBX(); } + /** + * Return the estimator type. + * + * @internal + * + * @return EstimatorType + */ + public function type() : EstimatorType + { + return $this->base->type(); + } + + /** + * Return the data types that the estimator is compatible with. + * + * @internal + * + * @return list<\Rubix\ML\DataType> + */ + public function compatibility() : array + { + return $this->base->compatibility(); + } + /** * Return the settings of the hyper-parameters in an associative array. * @@ -106,6 +134,16 @@ public function trained() : bool return $this->base->trained(); } + /** + * Return the base estimator instance. + * + * @return Estimator + */ + public function base() : Estimator + { + return $this->base; + } + /** * Save the model to storage. */ @@ -130,6 +168,17 @@ public function train(Dataset $dataset) : void $this->base->train($dataset); } + /** + * Make a prediction on a given sample dataset. + * + * @param Dataset $dataset + * @return mixed[] + */ + public function predict(Dataset $dataset) : array + { + return $this->base->predict($dataset); + } + /** * Estimate the joint probabilities for each possible outcome. * diff --git a/src/Pipeline.php b/src/Pipeline.php index 8df11bafa..06185fd11 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -4,7 +4,6 @@ use Rubix\ML\Helpers\Params; use Rubix\ML\Datasets\Dataset; -use Rubix\ML\Traits\WrapperAware; use Rubix\ML\Transformers\Elastic; use Rubix\ML\Transformers\Stateful; use Rubix\ML\Transformers\Transformer; @@ -28,7 +27,7 @@ */ class Pipeline implements Online, Probabilistic, Scoring, Persistable, Wrapper { - use AutotrackRevisions, WrapperAware; + use AutotrackRevisions; /** * A list of transformers to be applied in series. @@ -39,6 +38,13 @@ class Pipeline implements Online, Probabilistic, Scoring, Persistable, Wrapper // ]; + /** + * An instance of a base estimator to receive the transformed data. + * + * @var Estimator + */ + protected \Rubix\ML\Estimator $base; + /** * Should we update the elastic transformers during partial train? * @@ -66,6 +72,30 @@ public function __construct(array $transformers, Estimator $base, bool $elastic $this->elastic = $elastic; } + /** + * Return the estimator type. + * + * @internal + * + * @return EstimatorType + */ + public function type() : EstimatorType + { + return $this->base->type(); + } + + /** + * Return the data types that the estimator is compatible with. + * + * @internal + * + * @return list<\Rubix\ML\DataType> + */ + public function compatibility() : array + { + return $this->base->compatibility(); + } + /** * Return the settings of the hyper-parameters in an associative array. * @@ -94,6 +124,16 @@ public function trained() : bool : true; } + /** + * Return the base estimator instance. + * + * @return Estimator + */ + public function base() : Estimator + { + return $this->base; + } + /** * Run the training dataset through all transformers in order and use the * transformed dataset to train the estimator. diff --git a/src/Traits/WrapperAware.php b/src/Traits/WrapperAware.php deleted file mode 100644 index 1edb41640..000000000 --- a/src/Traits/WrapperAware.php +++ /dev/null @@ -1,73 +0,0 @@ -base; - } - - /** - * Return the estimator type. - * - * @internal - * - * @return EstimatorType - */ - public function type() : EstimatorType - { - return $this->base->type(); - } - - /** - * Return the data types that the estimator is compatible with. - * - * @internal - * - * @return list<\Rubix\ML\DataType> - */ - public function compatibility() : array - { - return $this->base->compatibility(); - } - - /** - * Make a prediction on a given sample dataset. - * - * @param Dataset $dataset - * @throws RuntimeException - * @return mixed[] - */ - public function predict(Dataset $dataset) : array - { - return $this->base->predict($dataset); - } -} \ No newline at end of file From 5a6bd43f130e1f95d2cc5f3c39d158ae2e490978 Mon Sep 17 00:00:00 2001 From: Ronan Giron Date: Mon, 22 Jan 2024 09:21:49 +0100 Subject: [PATCH 5/6] Rename Wrapper interface to EstimatorWrapper --- src/{Wrapper.php => EstimatorWrapper.php} | 8 ++++---- src/GridSearch.php | 2 +- src/PersistentModel.php | 2 +- src/Pipeline.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename src/{Wrapper.php => EstimatorWrapper.php} (63%) diff --git a/src/Wrapper.php b/src/EstimatorWrapper.php similarity index 63% rename from src/Wrapper.php rename to src/EstimatorWrapper.php index 9406a722b..aafb3ac8e 100644 --- a/src/Wrapper.php +++ b/src/EstimatorWrapper.php @@ -7,14 +7,14 @@ * * @category Machine Learning * @package Rubix/ML - * @author Andrew DalPino + * @author Ronan Giron */ -interface Wrapper extends Estimator +interface EstimatorWrapper extends Estimator { /** * Return the base estimator instance. * * @return Estimator */ - public function base(): Estimator; -} \ No newline at end of file + public function base() : Estimator; +} diff --git a/src/GridSearch.php b/src/GridSearch.php index 72bc5c64d..5a914f93e 100644 --- a/src/GridSearch.php +++ b/src/GridSearch.php @@ -39,7 +39,7 @@ * @package Rubix/ML * @author Andrew DalPino */ -class GridSearch implements Wrapper, Learner, Parallel, Verbose, Persistable +class GridSearch implements EstimatorWrapper, Learner, Parallel, Verbose, Persistable { use AutotrackRevisions, Multiprocessing, LoggerAware; diff --git a/src/PersistentModel.php b/src/PersistentModel.php index 195216ba7..54061682e 100644 --- a/src/PersistentModel.php +++ b/src/PersistentModel.php @@ -21,7 +21,7 @@ * @package Rubix/ML * @author Andrew DalPino */ -class PersistentModel implements Wrapper, Learner, Probabilistic, Scoring +class PersistentModel implements EstimatorWrapper, Learner, Probabilistic, Scoring { /** * The persistable base learner. diff --git a/src/Pipeline.php b/src/Pipeline.php index 06185fd11..8b4adbf90 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -25,7 +25,7 @@ * @package Rubix/ML * @author Andrew DalPino */ -class Pipeline implements Online, Probabilistic, Scoring, Persistable, Wrapper +class Pipeline implements Online, Probabilistic, Scoring, Persistable, EstimatorWrapper { use AutotrackRevisions; From 90e19de1f86f653b31d1ddc8c1bd0277191209d8 Mon Sep 17 00:00:00 2001 From: Ronan Giron Date: Mon, 22 Jan 2024 09:34:58 +0100 Subject: [PATCH 6/6] PHP CS fix --- src/AnomalyDetectors/LocalOutlierFactor.php | 2 +- src/AnomalyDetectors/Loda.php | 2 +- src/AnomalyDetectors/OneClassSVM.php | 4 ++-- src/BootstrapAggregator.php | 2 +- src/Classifiers/AdaBoost.php | 2 +- src/Classifiers/KDNeighbors.php | 2 +- src/Classifiers/KNearestNeighbors.php | 2 +- src/Classifiers/LogisticRegression.php | 6 +++--- src/Classifiers/LogitBoost.php | 4 ++-- src/Classifiers/MultilayerPerceptron.php | 8 ++++---- src/Classifiers/OneVsRest.php | 2 +- src/Classifiers/RadiusNeighbors.php | 2 +- src/Classifiers/RandomForest.php | 2 +- src/Classifiers/SoftmaxClassifier.php | 6 +++--- src/Clusterers/DBSCAN.php | 2 +- src/Clusterers/FuzzyCMeans.php | 4 ++-- src/Clusterers/GaussianMixture.php | 2 +- src/Clusterers/KMeans.php | 4 ++-- src/Clusterers/MeanShift.php | 4 ++-- src/Clusterers/Seeders/KMC2.php | 2 +- src/Clusterers/Seeders/PlusPlus.php | 2 +- src/Datasets/Generators/Blob.php | 2 +- src/Datasets/Generators/Circle.php | 2 +- src/Datasets/Generators/HalfMoon.php | 2 +- src/Datasets/Generators/Hyperplane.php | 2 +- src/Datasets/Generators/SwissRoll.php | 2 +- src/Extractors/SQLTable.php | 2 +- src/Graph/Nodes/Clique.php | 2 +- src/Graph/Nodes/Neighborhood.php | 2 +- src/Graph/Nodes/Traits/HasBinaryChildrenTrait.php | 4 ++-- src/Graph/Trees/BallTree.php | 4 ++-- src/Graph/Trees/DecisionTree.php | 2 +- src/Graph/Trees/ITree.php | 2 +- src/Graph/Trees/KDTree.php | 4 ++-- src/GridSearch.php | 6 +++--- src/NeuralNet/FeedForward.php | 6 +++--- src/NeuralNet/Layers/Activation.php | 6 +++--- src/NeuralNet/Layers/BatchNorm.php | 10 +++++----- src/NeuralNet/Layers/Binary.php | 8 ++++---- src/NeuralNet/Layers/Continuous.php | 4 ++-- src/NeuralNet/Layers/Dense.php | 10 +++++----- src/NeuralNet/Layers/Dropout.php | 2 +- src/NeuralNet/Layers/Multiclass.php | 8 ++++---- src/NeuralNet/Layers/PReLU.php | 6 +++--- src/NeuralNet/Layers/Swish.php | 10 +++++----- src/NeuralNet/Parameter.php | 2 +- src/PersistentModel.php | 6 +++--- src/Pipeline.php | 2 +- src/Regressors/Adaline.php | 6 +++--- src/Regressors/GradientBoost.php | 4 ++-- src/Regressors/KDNeighborsRegressor.php | 2 +- src/Regressors/KNNRegressor.php | 2 +- src/Regressors/MLPRegressor.php | 8 ++++---- src/Regressors/RadiusNeighborsRegressor.php | 2 +- src/Regressors/Ridge.php | 2 +- src/Regressors/SVR.php | 4 ++-- src/Serializers/GzipNative.php | 2 +- src/Serializers/RBX.php | 2 +- src/Specifications/DatasetHasDimensionality.php | 2 +- src/Specifications/DatasetIsLabeled.php | 2 +- src/Specifications/DatasetIsNotEmpty.php | 2 +- src/Specifications/EstimatorIsCompatibleWithMetric.php | 4 ++-- src/Specifications/LabelsAreCompatibleWithLearner.php | 4 ++-- .../SamplesAreCompatibleWithDistance.php | 4 ++-- .../SamplesAreCompatibleWithEstimator.php | 4 ++-- .../SamplesAreCompatibleWithTransformer.php | 4 ++-- src/Tokenizers/KSkipNGram.php | 4 ++-- src/Tokenizers/NGram.php | 4 ++-- src/Traits/LoggerAware.php | 2 +- src/Traits/Multiprocessing.php | 2 +- src/Transformers/GaussianRandomProjector.php | 2 +- src/Transformers/HotDeckImputer.php | 2 +- src/Transformers/KNNImputer.php | 2 +- src/Transformers/LinearDiscriminantAnalysis.php | 2 +- src/Transformers/MissingDataImputer.php | 4 ++-- src/Transformers/PrincipalComponentAnalysis.php | 2 +- src/Transformers/TSNE.php | 2 +- src/Transformers/TokenHashingVectorizer.php | 2 +- src/Transformers/TruncatedSVD.php | 2 +- src/Transformers/WordCountVectorizer.php | 2 +- tests/Graph/Nodes/NeighborhoodTest.php | 2 +- tests/NeuralNet/ParameterTest.php | 2 +- tests/Transformers/ImageRotatorTest.php | 2 +- 83 files changed, 142 insertions(+), 142 deletions(-) diff --git a/src/AnomalyDetectors/LocalOutlierFactor.php b/src/AnomalyDetectors/LocalOutlierFactor.php index 4ebda0f00..5c798b4b6 100644 --- a/src/AnomalyDetectors/LocalOutlierFactor.php +++ b/src/AnomalyDetectors/LocalOutlierFactor.php @@ -67,7 +67,7 @@ class LocalOutlierFactor implements Estimator, Learner, Scoring, Persistable * * @var Spatial */ - protected \Rubix\ML\Graph\Trees\Spatial $tree; + protected Spatial $tree; /** * The precomputed k distances between each training sample and its k'th nearest neighbor. diff --git a/src/AnomalyDetectors/Loda.php b/src/AnomalyDetectors/Loda.php index f06b9a4a7..cf76762e3 100644 --- a/src/AnomalyDetectors/Loda.php +++ b/src/AnomalyDetectors/Loda.php @@ -100,7 +100,7 @@ class Loda implements Estimator, Learner, Online, Scoring, Persistable * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $r = null; + protected ?Matrix $r = null; /** * The edges and bin counts of each histogram. diff --git a/src/AnomalyDetectors/OneClassSVM.php b/src/AnomalyDetectors/OneClassSVM.php index faf1111be..10969ab6f 100644 --- a/src/AnomalyDetectors/OneClassSVM.php +++ b/src/AnomalyDetectors/OneClassSVM.php @@ -44,7 +44,7 @@ class OneClassSVM implements Estimator, Learner * * @var svm */ - protected \svm $svm; + protected svm $svm; /** * The hyper-parameters of the model. @@ -58,7 +58,7 @@ class OneClassSVM implements Estimator, Learner * * @var \svmmodel|null */ - protected ?\svmmodel $model = null; + protected ?svmmodel $model = null; /** * @param float $nu diff --git a/src/BootstrapAggregator.php b/src/BootstrapAggregator.php index 742dcc6ab..fc30cc882 100644 --- a/src/BootstrapAggregator.php +++ b/src/BootstrapAggregator.php @@ -64,7 +64,7 @@ class BootstrapAggregator implements Estimator, Learner, Parallel, Persistable * * @var Learner */ - protected \Rubix\ML\Learner $base; + protected Learner $base; /** * The number of base learners to train in the ensemble. diff --git a/src/Classifiers/AdaBoost.php b/src/Classifiers/AdaBoost.php index 4f428c5f4..9c74fbd7a 100644 --- a/src/Classifiers/AdaBoost.php +++ b/src/Classifiers/AdaBoost.php @@ -72,7 +72,7 @@ class AdaBoost implements Estimator, Learner, Probabilistic, Verbose, Persistabl * * @var Learner */ - protected \Rubix\ML\Learner $base; + protected Learner $base; /** * The learning rate of the ensemble i.e. the *shrinkage* applied to each step. diff --git a/src/Classifiers/KDNeighbors.php b/src/Classifiers/KDNeighbors.php index 642b64e16..4ef9f5864 100644 --- a/src/Classifiers/KDNeighbors.php +++ b/src/Classifiers/KDNeighbors.php @@ -60,7 +60,7 @@ class KDNeighbors implements Estimator, Learner, Probabilistic, Persistable * * @var Spatial */ - protected \Rubix\ML\Graph\Trees\Spatial $tree; + protected Spatial $tree; /** * The zero vector for the possible class outcomes. diff --git a/src/Classifiers/KNearestNeighbors.php b/src/Classifiers/KNearestNeighbors.php index d5293c932..ee5c4b39b 100644 --- a/src/Classifiers/KNearestNeighbors.php +++ b/src/Classifiers/KNearestNeighbors.php @@ -62,7 +62,7 @@ class KNearestNeighbors implements Estimator, Learner, Online, Probabilistic, Pe * * @var Distance */ - protected \Rubix\ML\Kernels\Distance\Distance $kernel; + protected Distance $kernel; /** * The zero vector for the possible class outcomes. diff --git a/src/Classifiers/LogisticRegression.php b/src/Classifiers/LogisticRegression.php index ba67b5f57..b48ea7239 100644 --- a/src/Classifiers/LogisticRegression.php +++ b/src/Classifiers/LogisticRegression.php @@ -67,7 +67,7 @@ class LogisticRegression implements Estimator, Learner, Online, Probabilistic, R * * @var Optimizer */ - protected \Rubix\ML\NeuralNet\Optimizers\Optimizer $optimizer; + protected Optimizer $optimizer; /** * The amount of L2 regularization applied to the weights of the output layer. @@ -103,14 +103,14 @@ class LogisticRegression implements Estimator, Learner, Online, Probabilistic, R * * @var ClassificationLoss */ - protected \Rubix\ML\NeuralNet\CostFunctions\ClassificationLoss $costFn; + protected ClassificationLoss $costFn; /** * The underlying neural network instance. * * @var \Rubix\ML\NeuralNet\FeedForward|null */ - protected ?\Rubix\ML\NeuralNet\FeedForward $network = null; + protected ?FeedForward $network = null; /** * The unique class labels. diff --git a/src/Classifiers/LogitBoost.php b/src/Classifiers/LogitBoost.php index 071dfed39..f12588cfb 100644 --- a/src/Classifiers/LogitBoost.php +++ b/src/Classifiers/LogitBoost.php @@ -89,7 +89,7 @@ class LogitBoost implements Estimator, Learner, Probabilistic, RanksFeatures, Ve * * @var Learner */ - protected \Rubix\ML\Learner $booster; + protected Learner $booster; /** * The learning rate of the ensemble i.e. the *shrinkage* applied to each step. @@ -138,7 +138,7 @@ class LogitBoost implements Estimator, Learner, Probabilistic, RanksFeatures, Ve * * @var Metric */ - protected \Rubix\ML\CrossValidation\Metrics\Metric $metric; + protected Metric $metric; /** * The ensemble of boosters. diff --git a/src/Classifiers/MultilayerPerceptron.php b/src/Classifiers/MultilayerPerceptron.php index 1018d10c4..233c8b1eb 100644 --- a/src/Classifiers/MultilayerPerceptron.php +++ b/src/Classifiers/MultilayerPerceptron.php @@ -85,7 +85,7 @@ class MultilayerPerceptron implements Estimator, Learner, Online, Probabilistic, * * @var Optimizer */ - protected \Rubix\ML\NeuralNet\Optimizers\Optimizer $optimizer; + protected Optimizer $optimizer; /** * The amount of L2 regularization applied to the weights of the output layer. @@ -127,21 +127,21 @@ class MultilayerPerceptron implements Estimator, Learner, Online, Probabilistic, * * @var ClassificationLoss */ - protected \Rubix\ML\NeuralNet\CostFunctions\ClassificationLoss $costFn; + protected ClassificationLoss $costFn; /** * The validation metric used to score the generalization performance of the model during training. * * @var Metric */ - protected \Rubix\ML\CrossValidation\Metrics\Metric $metric; + protected Metric $metric; /** * The underlying neural network instance. * * @var \Rubix\ML\NeuralNet\FeedForward|null */ - protected ?\Rubix\ML\NeuralNet\FeedForward $network = null; + protected ?FeedForward $network = null; /** * The unique class labels. diff --git a/src/Classifiers/OneVsRest.php b/src/Classifiers/OneVsRest.php index 7c07e2627..841fb2751 100644 --- a/src/Classifiers/OneVsRest.php +++ b/src/Classifiers/OneVsRest.php @@ -51,7 +51,7 @@ class OneVsRest implements Estimator, Learner, Probabilistic, Parallel, Persista * * @var Learner */ - protected \Rubix\ML\Learner $base; + protected Learner $base; /** * A map of each class to its binary classifier. diff --git a/src/Classifiers/RadiusNeighbors.php b/src/Classifiers/RadiusNeighbors.php index b1e3544c9..1dc670186 100644 --- a/src/Classifiers/RadiusNeighbors.php +++ b/src/Classifiers/RadiusNeighbors.php @@ -60,7 +60,7 @@ class RadiusNeighbors implements Estimator, Learner, Probabilistic, Persistable * * @var Spatial */ - protected \Rubix\ML\Graph\Trees\Spatial $tree; + protected Spatial $tree; /** * The class label for any samples that have 0 neighbors within the specified radius. diff --git a/src/Classifiers/RandomForest.php b/src/Classifiers/RandomForest.php index 5d2b8d5cb..eb62f5e32 100644 --- a/src/Classifiers/RandomForest.php +++ b/src/Classifiers/RandomForest.php @@ -73,7 +73,7 @@ class RandomForest implements Estimator, Learner, Probabilistic, Parallel, Ranks * * @var Learner */ - protected \Rubix\ML\Learner $base; + protected Learner $base; /** * The number of learners to train in the ensemble. diff --git a/src/Classifiers/SoftmaxClassifier.php b/src/Classifiers/SoftmaxClassifier.php index 998035701..3038c04a3 100644 --- a/src/Classifiers/SoftmaxClassifier.php +++ b/src/Classifiers/SoftmaxClassifier.php @@ -64,7 +64,7 @@ class SoftmaxClassifier implements Estimator, Learner, Online, Probabilistic, Ve * * @var Optimizer */ - protected \Rubix\ML\NeuralNet\Optimizers\Optimizer $optimizer; + protected Optimizer $optimizer; /** * The amount of L2 regularization applied to the weights of the output layer. @@ -99,14 +99,14 @@ class SoftmaxClassifier implements Estimator, Learner, Online, Probabilistic, Ve * * @var ClassificationLoss */ - protected \Rubix\ML\NeuralNet\CostFunctions\ClassificationLoss $costFn; + protected ClassificationLoss $costFn; /** * The underlying neural network instance. * * @var \Rubix\ML\NeuralNet\FeedForward|null */ - protected ?\Rubix\ML\NeuralNet\FeedForward $network = null; + protected ?FeedForward $network = null; /** * The unique class labels. diff --git a/src/Clusterers/DBSCAN.php b/src/Clusterers/DBSCAN.php index 44112e02a..c24546d37 100644 --- a/src/Clusterers/DBSCAN.php +++ b/src/Clusterers/DBSCAN.php @@ -73,7 +73,7 @@ class DBSCAN implements Estimator * * @var Spatial */ - protected \Rubix\ML\Graph\Trees\Spatial $tree; + protected Spatial $tree; /** * @param float $radius diff --git a/src/Clusterers/FuzzyCMeans.php b/src/Clusterers/FuzzyCMeans.php index 49d5716ff..dd3b27b84 100644 --- a/src/Clusterers/FuzzyCMeans.php +++ b/src/Clusterers/FuzzyCMeans.php @@ -92,14 +92,14 @@ class FuzzyCMeans implements Estimator, Learner, Probabilistic, Verbose, Persist * * @var Distance */ - protected \Rubix\ML\Kernels\Distance\Distance $kernel; + protected Distance $kernel; /** * The cluster centroid seeder. * * @var Seeder */ - protected \Rubix\ML\Clusterers\Seeders\Seeder $seeder; + protected Seeder $seeder; /** * The computed centroid vectors of the training data. diff --git a/src/Clusterers/GaussianMixture.php b/src/Clusterers/GaussianMixture.php index 4445d0422..68338cfd9 100644 --- a/src/Clusterers/GaussianMixture.php +++ b/src/Clusterers/GaussianMixture.php @@ -97,7 +97,7 @@ class GaussianMixture implements Estimator, Learner, Probabilistic, Verbose, Per * * @var Seeder */ - protected \Rubix\ML\Clusterers\Seeders\Seeder $seeder; + protected Seeder $seeder; /** * The precomputed log prior probabilities of each cluster. diff --git a/src/Clusterers/KMeans.php b/src/Clusterers/KMeans.php index 852b178c4..280e70922 100644 --- a/src/Clusterers/KMeans.php +++ b/src/Clusterers/KMeans.php @@ -96,14 +96,14 @@ class KMeans implements Estimator, Learner, Online, Probabilistic, Verbose, Pers * * @var Distance */ - protected \Rubix\ML\Kernels\Distance\Distance $kernel; + protected Distance $kernel; /** * The cluster centroid seeder. * * @var Seeder */ - protected \Rubix\ML\Clusterers\Seeders\Seeder $seeder; + protected Seeder $seeder; /** * The computed centroid vectors of the training data. diff --git a/src/Clusterers/MeanShift.php b/src/Clusterers/MeanShift.php index 0d89ce00f..97af51353 100644 --- a/src/Clusterers/MeanShift.php +++ b/src/Clusterers/MeanShift.php @@ -104,14 +104,14 @@ class MeanShift implements Estimator, Learner, Probabilistic, Verbose, Persistab * * @var Spatial */ - protected \Rubix\ML\Graph\Trees\Spatial $tree; + protected Spatial $tree; /** * The cluster centroid seeder. * * @var Seeder */ - protected \Rubix\ML\Clusterers\Seeders\Seeder $seeder; + protected Seeder $seeder; /** * The computed centroid vectors of the training data. diff --git a/src/Clusterers/Seeders/KMC2.php b/src/Clusterers/Seeders/KMC2.php index d4e155e5e..717a29426 100644 --- a/src/Clusterers/Seeders/KMC2.php +++ b/src/Clusterers/Seeders/KMC2.php @@ -39,7 +39,7 @@ class KMC2 implements Seeder * * @var Distance */ - protected \Rubix\ML\Kernels\Distance\Distance $kernel; + protected Distance $kernel; /** * @param int $m diff --git a/src/Clusterers/Seeders/PlusPlus.php b/src/Clusterers/Seeders/PlusPlus.php index ad4f82e24..4a59d98b4 100644 --- a/src/Clusterers/Seeders/PlusPlus.php +++ b/src/Clusterers/Seeders/PlusPlus.php @@ -32,7 +32,7 @@ class PlusPlus implements Seeder * * @var Distance */ - protected \Rubix\ML\Kernels\Distance\Distance $kernel; + protected Distance $kernel; /** * @param \Rubix\ML\Kernels\Distance\Distance|null $kernel diff --git a/src/Datasets/Generators/Blob.php b/src/Datasets/Generators/Blob.php index 9af355ea5..4e741c985 100644 --- a/src/Datasets/Generators/Blob.php +++ b/src/Datasets/Generators/Blob.php @@ -28,7 +28,7 @@ class Blob implements Generator * * @var Vector */ - protected \Tensor\Vector $center; + protected Vector $center; /** * The standard deviation of the blob. diff --git a/src/Datasets/Generators/Circle.php b/src/Datasets/Generators/Circle.php index d0a5ee14c..aed785d65 100644 --- a/src/Datasets/Generators/Circle.php +++ b/src/Datasets/Generators/Circle.php @@ -27,7 +27,7 @@ class Circle implements Generator * * @var Vector */ - protected \Tensor\Vector $center; + protected Vector $center; /** * The scaling factor of the circle. diff --git a/src/Datasets/Generators/HalfMoon.php b/src/Datasets/Generators/HalfMoon.php index 26486240e..e41a4a265 100644 --- a/src/Datasets/Generators/HalfMoon.php +++ b/src/Datasets/Generators/HalfMoon.php @@ -26,7 +26,7 @@ class HalfMoon implements Generator * * @var Vector */ - protected \Tensor\Vector $center; + protected Vector $center; /** * The scaling factor of the half moon. diff --git a/src/Datasets/Generators/Hyperplane.php b/src/Datasets/Generators/Hyperplane.php index 8afa59934..a5ae532bc 100644 --- a/src/Datasets/Generators/Hyperplane.php +++ b/src/Datasets/Generators/Hyperplane.php @@ -27,7 +27,7 @@ class Hyperplane implements Generator * * @var Vector */ - protected \Tensor\Vector $coefficients; + protected Vector $coefficients; /** * The y intercept term. diff --git a/src/Datasets/Generators/SwissRoll.php b/src/Datasets/Generators/SwissRoll.php index 8cd017ffa..f0899a284 100644 --- a/src/Datasets/Generators/SwissRoll.php +++ b/src/Datasets/Generators/SwissRoll.php @@ -33,7 +33,7 @@ class SwissRoll implements Generator * * @var Vector */ - protected \Tensor\Vector $center; + protected Vector $center; /** * The scaling factor of the swiss roll. diff --git a/src/Extractors/SQLTable.php b/src/Extractors/SQLTable.php index 4d2b8ed5f..50359addf 100644 --- a/src/Extractors/SQLTable.php +++ b/src/Extractors/SQLTable.php @@ -30,7 +30,7 @@ class SQLTable implements Extractor * * @var PDO */ - protected \PDO $connection; + protected PDO $connection; /** * The name of the table to select from. diff --git a/src/Graph/Nodes/Clique.php b/src/Graph/Nodes/Clique.php index 8b6dedd45..169c023a0 100644 --- a/src/Graph/Nodes/Clique.php +++ b/src/Graph/Nodes/Clique.php @@ -26,7 +26,7 @@ class Clique implements Hypersphere, BinaryNode * * @var Labeled */ - protected \Rubix\ML\Datasets\Labeled $dataset; + protected Labeled $dataset; /** * The centroid or multivariate mean of the cluster. diff --git a/src/Graph/Nodes/Neighborhood.php b/src/Graph/Nodes/Neighborhood.php index 9fce001f2..688f892fd 100644 --- a/src/Graph/Nodes/Neighborhood.php +++ b/src/Graph/Nodes/Neighborhood.php @@ -24,7 +24,7 @@ class Neighborhood implements Hypercube, BinaryNode * * @var Labeled */ - protected \Rubix\ML\Datasets\Labeled $dataset; + protected Labeled $dataset; /** * The multivariate minimum of the bounding box. diff --git a/src/Graph/Nodes/Traits/HasBinaryChildrenTrait.php b/src/Graph/Nodes/Traits/HasBinaryChildrenTrait.php index a0c08a4c4..76aa8f484 100644 --- a/src/Graph/Nodes/Traits/HasBinaryChildrenTrait.php +++ b/src/Graph/Nodes/Traits/HasBinaryChildrenTrait.php @@ -23,14 +23,14 @@ trait HasBinaryChildrenTrait * * @var \Rubix\ML\Graph\Nodes\BinaryNode|null */ - protected ?\Rubix\ML\Graph\Nodes\BinaryNode $left = null; + protected ?BinaryNode $left = null; /** * The right child node. * * @var \Rubix\ML\Graph\Nodes\BinaryNode|null */ - protected ?\Rubix\ML\Graph\Nodes\BinaryNode $right = null; + protected ?BinaryNode $right = null; /** * Return the children of this node in a generator. diff --git a/src/Graph/Trees/BallTree.php b/src/Graph/Trees/BallTree.php index f6e02d029..8194e779a 100644 --- a/src/Graph/Trees/BallTree.php +++ b/src/Graph/Trees/BallTree.php @@ -47,14 +47,14 @@ class BallTree implements BinaryTree, Spatial * * @var Distance */ - protected \Rubix\ML\Kernels\Distance\Distance $kernel; + protected Distance $kernel; /** * The root node of the tree. * * @var \Rubix\ML\Graph\Nodes\Ball|null */ - protected ?\Rubix\ML\Graph\Nodes\Ball $root = null; + protected ?Ball $root = null; /** * @param int $maxLeafSize diff --git a/src/Graph/Trees/DecisionTree.php b/src/Graph/Trees/DecisionTree.php index 5c98f0e44..63be69730 100644 --- a/src/Graph/Trees/DecisionTree.php +++ b/src/Graph/Trees/DecisionTree.php @@ -67,7 +67,7 @@ abstract class DecisionTree implements BinaryTree, IteratorAggregate * * @var \Rubix\ML\Graph\Nodes\Split|null */ - protected ?\Rubix\ML\Graph\Nodes\Split $root = null; + protected ?Split $root = null; /** * The number of feature columns in the training set. diff --git a/src/Graph/Trees/ITree.php b/src/Graph/Trees/ITree.php index d44883033..23df4e8d7 100644 --- a/src/Graph/Trees/ITree.php +++ b/src/Graph/Trees/ITree.php @@ -43,7 +43,7 @@ class ITree implements BinaryTree * * @var \Rubix\ML\Graph\Nodes\Isolator|null */ - protected ?\Rubix\ML\Graph\Nodes\Isolator $root = null; + protected ?Isolator $root = null; /** * @param int $maxHeight diff --git a/src/Graph/Trees/KDTree.php b/src/Graph/Trees/KDTree.php index 20174695d..737b075be 100644 --- a/src/Graph/Trees/KDTree.php +++ b/src/Graph/Trees/KDTree.php @@ -46,14 +46,14 @@ class KDTree implements BinaryTree, Spatial * * @var Distance */ - protected \Rubix\ML\Kernels\Distance\Distance $kernel; + protected Distance $kernel; /** * The root node of the tree. * * @var \Rubix\ML\Graph\Nodes\Box|null */ - protected ?\Rubix\ML\Graph\Nodes\Box $root = null; + protected ?Box $root = null; /** * @param int $maxLeafSize diff --git a/src/GridSearch.php b/src/GridSearch.php index 5a914f93e..7dbe24f16 100644 --- a/src/GridSearch.php +++ b/src/GridSearch.php @@ -62,21 +62,21 @@ class GridSearch implements EstimatorWrapper, Learner, Parallel, Verbose, Persis * * @var Metric */ - protected \Rubix\ML\CrossValidation\Metrics\Metric $metric; + protected Metric $metric; /** * The validator used to test the estimator. * * @var Validator */ - protected \Rubix\ML\CrossValidation\Validator $validator; + protected Validator $validator; /** * The base estimator instance. * * @var Learner */ - protected \Rubix\ML\Learner $base; + protected Learner $base; /** * The validation scores obtained from the last search. diff --git a/src/NeuralNet/FeedForward.php b/src/NeuralNet/FeedForward.php index 957824c8c..af12139d7 100644 --- a/src/NeuralNet/FeedForward.php +++ b/src/NeuralNet/FeedForward.php @@ -34,7 +34,7 @@ class FeedForward implements Network * * @var Input */ - protected \Rubix\ML\NeuralNet\Layers\Input $input; + protected Input $input; /** * The hidden layers of the network. @@ -59,14 +59,14 @@ class FeedForward implements Network * * @var Output */ - protected \Rubix\ML\NeuralNet\Layers\Output $output; + protected Output $output; /** * The gradient descent optimizer used to train the network. * * @var Optimizer */ - protected \Rubix\ML\NeuralNet\Optimizers\Optimizer $optimizer; + protected Optimizer $optimizer; /** * @param Input $input diff --git a/src/NeuralNet/Layers/Activation.php b/src/NeuralNet/Layers/Activation.php index f0370f49e..29b5f37c2 100644 --- a/src/NeuralNet/Layers/Activation.php +++ b/src/NeuralNet/Layers/Activation.php @@ -25,7 +25,7 @@ class Activation implements Hidden * * @var ActivationFunction */ - protected \Rubix\ML\NeuralNet\ActivationFunctions\ActivationFunction $activationFn; + protected ActivationFunction $activationFn; /** * The width of the layer. @@ -39,14 +39,14 @@ class Activation implements Hidden * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $input = null; + protected ?Matrix $input = null; /** * The memorized activation matrix. * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $output = null; + protected ?Matrix $output = null; /** * @param ActivationFunction $activationFn diff --git a/src/NeuralNet/Layers/BatchNorm.php b/src/NeuralNet/Layers/BatchNorm.php index bc720dc68..d1a8e8631 100644 --- a/src/NeuralNet/Layers/BatchNorm.php +++ b/src/NeuralNet/Layers/BatchNorm.php @@ -45,14 +45,14 @@ class BatchNorm implements Hidden, Parametric * * @var Initializer */ - protected \Rubix\ML\NeuralNet\Initializers\Initializer $betaInitializer; + protected Initializer $betaInitializer; /** * The initializer for the gamma parameter. * * @var Initializer */ - protected \Rubix\ML\NeuralNet\Initializers\Initializer $gammaInitializer; + protected Initializer $gammaInitializer; /** * The width of the layer. i.e. the number of neurons. @@ -66,14 +66,14 @@ class BatchNorm implements Hidden, Parametric * * @var \Rubix\ML\NeuralNet\Parameter|null */ - protected ?\Rubix\ML\NeuralNet\Parameter $beta = null; + protected ?Parameter $beta = null; /** * The learnable scaling parameter. * * @var \Rubix\ML\NeuralNet\Parameter|null */ - protected ?\Rubix\ML\NeuralNet\Parameter $gamma = null; + protected ?Parameter $gamma = null; /** * The running mean of each input dimension. @@ -101,7 +101,7 @@ class BatchNorm implements Hidden, Parametric * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $xHat = null; + protected ?Matrix $xHat = null; /** * @param float $decay diff --git a/src/NeuralNet/Layers/Binary.php b/src/NeuralNet/Layers/Binary.php index fdd3d9807..109231823 100644 --- a/src/NeuralNet/Layers/Binary.php +++ b/src/NeuralNet/Layers/Binary.php @@ -41,28 +41,28 @@ class Binary implements Output * * @var ClassificationLoss */ - protected \Rubix\ML\NeuralNet\CostFunctions\ClassificationLoss $costFn; + protected ClassificationLoss $costFn; /** * The sigmoid activation function. * * @var Sigmoid */ - protected \Rubix\ML\NeuralNet\ActivationFunctions\Sigmoid $sigmoid; + protected Sigmoid $sigmoid; /** * The memorized input matrix. * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $input = null; + protected ?Matrix $input = null; /** * The memorized activation matrix. * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $output = null; + protected ?Matrix $output = null; /** * @param string[] $classes diff --git a/src/NeuralNet/Layers/Continuous.php b/src/NeuralNet/Layers/Continuous.php index b5be4fe29..938c0900a 100644 --- a/src/NeuralNet/Layers/Continuous.php +++ b/src/NeuralNet/Layers/Continuous.php @@ -28,14 +28,14 @@ class Continuous implements Output * * @var RegressionLoss */ - protected \Rubix\ML\NeuralNet\CostFunctions\RegressionLoss $costFn; + protected RegressionLoss $costFn; /** * The memorized input matrix. * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $input = null; + protected ?Matrix $input = null; /** * @param \Rubix\ML\NeuralNet\CostFunctions\RegressionLoss|null $costFn diff --git a/src/NeuralNet/Layers/Dense.php b/src/NeuralNet/Layers/Dense.php index 677e1f942..4bcfcb0bb 100644 --- a/src/NeuralNet/Layers/Dense.php +++ b/src/NeuralNet/Layers/Dense.php @@ -54,35 +54,35 @@ class Dense implements Hidden, Parametric * * @var Initializer */ - protected \Rubix\ML\NeuralNet\Initializers\Initializer $weightInitializer; + protected Initializer $weightInitializer; /** * The bias initializer. * * @var Initializer */ - protected \Rubix\ML\NeuralNet\Initializers\Initializer $biasInitializer; + protected Initializer $biasInitializer; /** * The weights. * * @var \Rubix\ML\NeuralNet\Parameter|null */ - protected ?\Rubix\ML\NeuralNet\Parameter $weights = null; + protected ?Parameter $weights = null; /** * The biases. * * @var \Rubix\ML\NeuralNet\Parameter|null */ - protected ?\Rubix\ML\NeuralNet\Parameter $biases = null; + protected ?Parameter $biases = null; /** * The memorized inputs to the layer. * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $input = null; + protected ?Matrix $input = null; /** * @param int $neurons diff --git a/src/NeuralNet/Layers/Dropout.php b/src/NeuralNet/Layers/Dropout.php index ee8a9585c..3f888dbda 100644 --- a/src/NeuralNet/Layers/Dropout.php +++ b/src/NeuralNet/Layers/Dropout.php @@ -52,7 +52,7 @@ class Dropout implements Hidden * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $mask = null; + protected ?Matrix $mask = null; /** * @param float $ratio diff --git a/src/NeuralNet/Layers/Multiclass.php b/src/NeuralNet/Layers/Multiclass.php index 9415e7e08..f5073d2e9 100644 --- a/src/NeuralNet/Layers/Multiclass.php +++ b/src/NeuralNet/Layers/Multiclass.php @@ -41,28 +41,28 @@ class Multiclass implements Output * * @var ClassificationLoss */ - protected \Rubix\ML\NeuralNet\CostFunctions\ClassificationLoss $costFn; + protected ClassificationLoss $costFn; /** * The softmax activation function. * * @var Softmax */ - protected \Rubix\ML\NeuralNet\ActivationFunctions\Softmax $softmax; + protected Softmax $softmax; /** * The memorized input matrix. * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $input = null; + protected ?Matrix $input = null; /** * The memorized activation matrix. * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $output = null; + protected ?Matrix $output = null; /** * @param string[] $classes diff --git a/src/NeuralNet/Layers/PReLU.php b/src/NeuralNet/Layers/PReLU.php index e208703c9..c90eda9d9 100644 --- a/src/NeuralNet/Layers/PReLU.php +++ b/src/NeuralNet/Layers/PReLU.php @@ -32,7 +32,7 @@ class PReLU implements Hidden, Parametric * * @var Initializer */ - protected \Rubix\ML\NeuralNet\Initializers\Initializer $initializer; + protected Initializer $initializer; /** * The width of the layer. @@ -46,14 +46,14 @@ class PReLU implements Hidden, Parametric * * @var \Rubix\ML\NeuralNet\Parameter|null */ - protected ?\Rubix\ML\NeuralNet\Parameter $alpha = null; + protected ?Parameter $alpha = null; /** * The memoized input matrix. * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $input = null; + protected ?Matrix $input = null; /** * @param \Rubix\ML\NeuralNet\Initializers\Initializer|null $initializer diff --git a/src/NeuralNet/Layers/Swish.php b/src/NeuralNet/Layers/Swish.php index 3a85e8c50..4ad02959d 100644 --- a/src/NeuralNet/Layers/Swish.php +++ b/src/NeuralNet/Layers/Swish.php @@ -33,14 +33,14 @@ class Swish implements Hidden, Parametric * * @var Initializer */ - protected \Rubix\ML\NeuralNet\Initializers\Initializer $initializer; + protected Initializer $initializer; /** * The sigmoid activation function. * * @var Sigmoid */ - protected \Rubix\ML\NeuralNet\ActivationFunctions\Sigmoid $sigmoid; + protected Sigmoid $sigmoid; /** * The width of the layer. @@ -54,21 +54,21 @@ class Swish implements Hidden, Parametric * * @var \Rubix\ML\NeuralNet\Parameter|null */ - protected ?\Rubix\ML\NeuralNet\Parameter $beta = null; + protected ?Parameter $beta = null; /** * The memoized input matrix. * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $input = null; + protected ?Matrix $input = null; /** * The memorized activation matrix. * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $output = null; + protected ?Matrix $output = null; /** * @param \Rubix\ML\NeuralNet\Initializers\Initializer|null $initializer diff --git a/src/NeuralNet/Parameter.php b/src/NeuralNet/Parameter.php index 202aa1e5b..39fc34c9a 100644 --- a/src/NeuralNet/Parameter.php +++ b/src/NeuralNet/Parameter.php @@ -35,7 +35,7 @@ class Parameter * * @var Tensor */ - protected \Tensor\Tensor $param; + protected Tensor $param; /** * @param Tensor $param diff --git a/src/PersistentModel.php b/src/PersistentModel.php index 54061682e..8aa07ed62 100644 --- a/src/PersistentModel.php +++ b/src/PersistentModel.php @@ -28,21 +28,21 @@ class PersistentModel implements EstimatorWrapper, Learner, Probabilistic, Scori * * @var Learner */ - protected \Rubix\ML\Learner $base; + protected Learner $base; /** * The persister used to interface with the storage layer. * * @var Persister */ - protected \Rubix\ML\Persisters\Persister $persister; + protected Persister $persister; /** * The object serializer. * * @var Serializer */ - protected \Rubix\ML\Serializers\Serializer $serializer; + protected Serializer $serializer; /** * Factory method to restore the model from persistence. diff --git a/src/Pipeline.php b/src/Pipeline.php index 8b4adbf90..53b79c8ec 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -43,7 +43,7 @@ class Pipeline implements Online, Probabilistic, Scoring, Persistable, Estimator * * @var Estimator */ - protected \Rubix\ML\Estimator $base; + protected Estimator $base; /** * Should we update the elastic transformers during partial train? diff --git a/src/Regressors/Adaline.php b/src/Regressors/Adaline.php index 605484353..fa29764a9 100644 --- a/src/Regressors/Adaline.php +++ b/src/Regressors/Adaline.php @@ -68,7 +68,7 @@ class Adaline implements Estimator, Learner, Online, RanksFeatures, Verbose, Per * * @var Optimizer */ - protected \Rubix\ML\NeuralNet\Optimizers\Optimizer $optimizer; + protected Optimizer $optimizer; /** * The amount of L2 regularization applied to the weights of the output layer. @@ -104,14 +104,14 @@ class Adaline implements Estimator, Learner, Online, RanksFeatures, Verbose, Per * * @var RegressionLoss */ - protected \Rubix\ML\NeuralNet\CostFunctions\RegressionLoss $costFn; + protected RegressionLoss $costFn; /** * The underlying neural network instance. * * @var \Rubix\ML\NeuralNet\FeedForward|null */ - protected ?\Rubix\ML\NeuralNet\FeedForward $network = null; + protected ?FeedForward $network = null; /** * The loss at each epoch from the last training session. diff --git a/src/Regressors/GradientBoost.php b/src/Regressors/GradientBoost.php index 979812c8b..c7d78e913 100644 --- a/src/Regressors/GradientBoost.php +++ b/src/Regressors/GradientBoost.php @@ -85,7 +85,7 @@ class GradientBoost implements Estimator, Learner, RanksFeatures, Verbose, Persi * * @var Learner */ - protected \Rubix\ML\Learner $booster; + protected Learner $booster; /** * The learning rate of the ensemble i.e. the *shrinkage* applied to each step. @@ -135,7 +135,7 @@ class GradientBoost implements Estimator, Learner, RanksFeatures, Verbose, Persi * * @var Metric */ - protected \Rubix\ML\CrossValidation\Metrics\Metric $metric; + protected Metric $metric; /** * An ensemble of weak regressors. diff --git a/src/Regressors/KDNeighborsRegressor.php b/src/Regressors/KDNeighborsRegressor.php index 1c2ec75da..7324002ce 100644 --- a/src/Regressors/KDNeighborsRegressor.php +++ b/src/Regressors/KDNeighborsRegressor.php @@ -58,7 +58,7 @@ class KDNeighborsRegressor implements Estimator, Learner, Persistable * * @var Spatial */ - protected \Rubix\ML\Graph\Trees\Spatial $tree; + protected Spatial $tree; /** * The dimensionality of the training set. diff --git a/src/Regressors/KNNRegressor.php b/src/Regressors/KNNRegressor.php index be9390e6e..aeaaabe5c 100644 --- a/src/Regressors/KNNRegressor.php +++ b/src/Regressors/KNNRegressor.php @@ -62,7 +62,7 @@ class KNNRegressor implements Estimator, Learner, Online, Persistable * * @var Distance */ - protected \Rubix\ML\Kernels\Distance\Distance $kernel; + protected Distance $kernel; /** * The training samples. diff --git a/src/Regressors/MLPRegressor.php b/src/Regressors/MLPRegressor.php index 57cf7be97..426cbd754 100644 --- a/src/Regressors/MLPRegressor.php +++ b/src/Regressors/MLPRegressor.php @@ -84,7 +84,7 @@ class MLPRegressor implements Estimator, Learner, Online, Verbose, Persistable * * @var Optimizer */ - protected \Rubix\ML\NeuralNet\Optimizers\Optimizer $optimizer; + protected Optimizer $optimizer; /** * The amount of L2 regularization applied to the weights of the output layer. @@ -126,21 +126,21 @@ class MLPRegressor implements Estimator, Learner, Online, Verbose, Persistable * * @var RegressionLoss */ - protected \Rubix\ML\NeuralNet\CostFunctions\RegressionLoss $costFn; + protected RegressionLoss $costFn; /** * The metric used to score the generalization performance of the model during training. * * @var Metric */ - protected \Rubix\ML\CrossValidation\Metrics\Metric $metric; + protected Metric $metric; /** * The underlying neural network instance. * * @var \Rubix\ML\NeuralNet\FeedForward|null */ - protected ?\Rubix\ML\NeuralNet\FeedForward $network = null; + protected ?FeedForward $network = null; /** * The validation scores at each epoch from the last training session. diff --git a/src/Regressors/RadiusNeighborsRegressor.php b/src/Regressors/RadiusNeighborsRegressor.php index 4748acfc6..2075e7b2e 100644 --- a/src/Regressors/RadiusNeighborsRegressor.php +++ b/src/Regressors/RadiusNeighborsRegressor.php @@ -66,7 +66,7 @@ class RadiusNeighborsRegressor implements Estimator, Learner, Persistable * * @var Spatial */ - protected \Rubix\ML\Graph\Trees\Spatial $tree; + protected Spatial $tree; /** * The dimensionality of the training set. diff --git a/src/Regressors/Ridge.php b/src/Regressors/Ridge.php index 329b3935c..999d3afd5 100644 --- a/src/Regressors/Ridge.php +++ b/src/Regressors/Ridge.php @@ -58,7 +58,7 @@ class Ridge implements Estimator, Learner, RanksFeatures, Persistable * * @var \Tensor\Vector|null */ - protected ?\Tensor\Vector $coefficients = null; + protected ?Vector $coefficients = null; /** * @param float $l2Penalty diff --git a/src/Regressors/SVR.php b/src/Regressors/SVR.php index a289b1953..5967f6678 100644 --- a/src/Regressors/SVR.php +++ b/src/Regressors/SVR.php @@ -50,7 +50,7 @@ class SVR implements Estimator, Learner * * @var svm */ - protected \svm $svm; + protected svm $svm; /** * The memoized hyper-parameters of the model. @@ -64,7 +64,7 @@ class SVR implements Estimator, Learner * * @var \svmmodel|null */ - protected ?\svmmodel $model = null; + protected ?svmmodel $model = null; /** * @param float $c diff --git a/src/Serializers/GzipNative.php b/src/Serializers/GzipNative.php index 24ae98585..f55134378 100644 --- a/src/Serializers/GzipNative.php +++ b/src/Serializers/GzipNative.php @@ -34,7 +34,7 @@ class GzipNative implements Serializer * * @var Native */ - protected \Rubix\ML\Serializers\Native $base; + protected Native $base; /** * @param int $level diff --git a/src/Serializers/RBX.php b/src/Serializers/RBX.php index 5e9b9999b..4ba5d9e94 100644 --- a/src/Serializers/RBX.php +++ b/src/Serializers/RBX.php @@ -64,7 +64,7 @@ class RBX implements Serializer * * @var GzipNative */ - protected \Rubix\ML\Serializers\GzipNative $base; + protected GzipNative $base; /** * @param int $level diff --git a/src/Specifications/DatasetHasDimensionality.php b/src/Specifications/DatasetHasDimensionality.php index bb71b086c..cf08ae837 100644 --- a/src/Specifications/DatasetHasDimensionality.php +++ b/src/Specifications/DatasetHasDimensionality.php @@ -16,7 +16,7 @@ class DatasetHasDimensionality extends Specification * * @var Dataset */ - protected \Rubix\ML\Datasets\Dataset $dataset; + protected Dataset $dataset; /** * The target dimensionality. diff --git a/src/Specifications/DatasetIsLabeled.php b/src/Specifications/DatasetIsLabeled.php index 7ebf4e56d..55614bc99 100644 --- a/src/Specifications/DatasetIsLabeled.php +++ b/src/Specifications/DatasetIsLabeled.php @@ -16,7 +16,7 @@ class DatasetIsLabeled extends Specification * * @var Dataset */ - protected \Rubix\ML\Datasets\Dataset $dataset; + protected Dataset $dataset; /** * Build a specification object with the given arguments. diff --git a/src/Specifications/DatasetIsNotEmpty.php b/src/Specifications/DatasetIsNotEmpty.php index be7048efc..8e53ea129 100644 --- a/src/Specifications/DatasetIsNotEmpty.php +++ b/src/Specifications/DatasetIsNotEmpty.php @@ -15,7 +15,7 @@ class DatasetIsNotEmpty extends Specification * * @var Dataset */ - protected \Rubix\ML\Datasets\Dataset $dataset; + protected Dataset $dataset; /** * Build a specification object with the given arguments. diff --git a/src/Specifications/EstimatorIsCompatibleWithMetric.php b/src/Specifications/EstimatorIsCompatibleWithMetric.php index 16dd51b52..47a4db9de 100644 --- a/src/Specifications/EstimatorIsCompatibleWithMetric.php +++ b/src/Specifications/EstimatorIsCompatibleWithMetric.php @@ -18,14 +18,14 @@ class EstimatorIsCompatibleWithMetric extends Specification * * @var Estimator */ - protected \Rubix\ML\Estimator $estimator; + protected Estimator $estimator; /** * The validation metric. * * @var Metric */ - protected \Rubix\ML\CrossValidation\Metrics\Metric $metric; + protected Metric $metric; /** * Build a specification object with the given arguments. diff --git a/src/Specifications/LabelsAreCompatibleWithLearner.php b/src/Specifications/LabelsAreCompatibleWithLearner.php index d207a0577..23e8f70d5 100644 --- a/src/Specifications/LabelsAreCompatibleWithLearner.php +++ b/src/Specifications/LabelsAreCompatibleWithLearner.php @@ -18,14 +18,14 @@ class LabelsAreCompatibleWithLearner extends Specification * * @var Labeled */ - protected \Rubix\ML\Datasets\Labeled $dataset; + protected Labeled $dataset; /** * The learner instance. * * @var Learner */ - protected \Rubix\ML\Learner $estimator; + protected Learner $estimator; /** * Build a specification object with the given arguments. diff --git a/src/Specifications/SamplesAreCompatibleWithDistance.php b/src/Specifications/SamplesAreCompatibleWithDistance.php index 30af77575..047c34bb6 100644 --- a/src/Specifications/SamplesAreCompatibleWithDistance.php +++ b/src/Specifications/SamplesAreCompatibleWithDistance.php @@ -18,14 +18,14 @@ class SamplesAreCompatibleWithDistance extends Specification * * @var Dataset */ - protected \Rubix\ML\Datasets\Dataset $dataset; + protected Dataset $dataset; /** * The distance kernel. * * @var Distance */ - protected \Rubix\ML\Kernels\Distance\Distance $kernel; + protected Distance $kernel; /** * Build a specification object with the given arguments. diff --git a/src/Specifications/SamplesAreCompatibleWithEstimator.php b/src/Specifications/SamplesAreCompatibleWithEstimator.php index 07d78a520..5383fbb4a 100644 --- a/src/Specifications/SamplesAreCompatibleWithEstimator.php +++ b/src/Specifications/SamplesAreCompatibleWithEstimator.php @@ -18,14 +18,14 @@ class SamplesAreCompatibleWithEstimator extends Specification * * @var Dataset */ - protected \Rubix\ML\Datasets\Dataset $dataset; + protected Dataset $dataset; /** * The estimator. * * @var Estimator */ - protected \Rubix\ML\Estimator $estimator; + protected Estimator $estimator; /** * Build a specification object with the given arguments. diff --git a/src/Specifications/SamplesAreCompatibleWithTransformer.php b/src/Specifications/SamplesAreCompatibleWithTransformer.php index 0396d491e..c5e601d07 100644 --- a/src/Specifications/SamplesAreCompatibleWithTransformer.php +++ b/src/Specifications/SamplesAreCompatibleWithTransformer.php @@ -18,14 +18,14 @@ class SamplesAreCompatibleWithTransformer extends Specification * * @var Dataset */ - protected \Rubix\ML\Datasets\Dataset $dataset; + protected Dataset $dataset; /** * The transformer. * * @var Transformer */ - protected \Rubix\ML\Transformers\Transformer $transformer; + protected Transformer $transformer; /** * Build a specification object with the given arguments. diff --git a/src/Tokenizers/KSkipNGram.php b/src/Tokenizers/KSkipNGram.php index d51f13529..e77884b97 100644 --- a/src/Tokenizers/KSkipNGram.php +++ b/src/Tokenizers/KSkipNGram.php @@ -57,14 +57,14 @@ class KSkipNGram implements Tokenizer * * @var Word */ - protected \Rubix\ML\Tokenizers\Word $wordTokenizer; + protected Word $wordTokenizer; /** * The sentence tokenizer. * * @var Sentence */ - protected \Rubix\ML\Tokenizers\Sentence $sentenceTokenizer; + protected Sentence $sentenceTokenizer; /** * @param int $min diff --git a/src/Tokenizers/NGram.php b/src/Tokenizers/NGram.php index 92becb5d9..744959029 100644 --- a/src/Tokenizers/NGram.php +++ b/src/Tokenizers/NGram.php @@ -46,14 +46,14 @@ class NGram implements Tokenizer * * @var Word */ - protected \Rubix\ML\Tokenizers\Word $wordTokenizer; + protected Word $wordTokenizer; /** * The sentence tokenizer. * * @var Sentence */ - protected \Rubix\ML\Tokenizers\Sentence $sentenceTokenizer; + protected Sentence $sentenceTokenizer; /** * @param int $min diff --git a/src/Traits/LoggerAware.php b/src/Traits/LoggerAware.php index 371da7271..b08e30219 100644 --- a/src/Traits/LoggerAware.php +++ b/src/Traits/LoggerAware.php @@ -20,7 +20,7 @@ trait LoggerAware * * @var \Psr\Log\LoggerInterface|null */ - protected ?\Psr\Log\LoggerInterface $logger = null; + protected ?LoggerInterface $logger = null; /** * Sets a PSR-3 logger instance. diff --git a/src/Traits/Multiprocessing.php b/src/Traits/Multiprocessing.php index a9d1b9b28..de1e862ee 100644 --- a/src/Traits/Multiprocessing.php +++ b/src/Traits/Multiprocessing.php @@ -27,7 +27,7 @@ trait Multiprocessing * * @var Backend */ - protected \Rubix\ML\Backends\Backend $backend; + protected Backend $backend; /** * Set the parallel processing backend. diff --git a/src/Transformers/GaussianRandomProjector.php b/src/Transformers/GaussianRandomProjector.php index 9af543c8f..ae383213b 100644 --- a/src/Transformers/GaussianRandomProjector.php +++ b/src/Transformers/GaussianRandomProjector.php @@ -41,7 +41,7 @@ class GaussianRandomProjector implements Transformer, Stateful, Persistable * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $r = null; + protected ?Matrix $r = null; /** * Estimate the minimum dimensionality needed to satisfy a *max distortion* constraint with *n* diff --git a/src/Transformers/HotDeckImputer.php b/src/Transformers/HotDeckImputer.php index 8d1c3183d..9d6633815 100644 --- a/src/Transformers/HotDeckImputer.php +++ b/src/Transformers/HotDeckImputer.php @@ -73,7 +73,7 @@ class HotDeckImputer implements Transformer, Stateful, Persistable * * @var Spatial */ - protected \Rubix\ML\Graph\Trees\Spatial $tree; + protected Spatial $tree; /** * @param int $k diff --git a/src/Transformers/KNNImputer.php b/src/Transformers/KNNImputer.php index 9415940cb..8bac119ab 100644 --- a/src/Transformers/KNNImputer.php +++ b/src/Transformers/KNNImputer.php @@ -73,7 +73,7 @@ class KNNImputer implements Transformer, Stateful, Persistable * * @var Spatial */ - protected \Rubix\ML\Graph\Trees\Spatial $tree; + protected Spatial $tree; /** * The data types of the fitted feature columns. diff --git a/src/Transformers/LinearDiscriminantAnalysis.php b/src/Transformers/LinearDiscriminantAnalysis.php index dc024fad2..1a1164d66 100644 --- a/src/Transformers/LinearDiscriminantAnalysis.php +++ b/src/Transformers/LinearDiscriminantAnalysis.php @@ -49,7 +49,7 @@ class LinearDiscriminantAnalysis implements Transformer, Stateful, Persistable * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $eigenvectors = null; + protected ?Matrix $eigenvectors = null; /** * The percentage of information lost due to the transformation. diff --git a/src/Transformers/MissingDataImputer.php b/src/Transformers/MissingDataImputer.php index 5175ed0f4..71b4cb337 100644 --- a/src/Transformers/MissingDataImputer.php +++ b/src/Transformers/MissingDataImputer.php @@ -34,14 +34,14 @@ class MissingDataImputer implements Transformer, Stateful, Persistable * * @var Strategy */ - protected \Rubix\ML\Strategies\Strategy $continuous; + protected Strategy $continuous; /** * The guessing strategy to use when imputing categorical values. * * @var Strategy */ - protected \Rubix\ML\Strategies\Strategy $categorical; + protected Strategy $categorical; /** * The placeholder category that denotes missing values. diff --git a/src/Transformers/PrincipalComponentAnalysis.php b/src/Transformers/PrincipalComponentAnalysis.php index aeabdbc2d..896795d86 100644 --- a/src/Transformers/PrincipalComponentAnalysis.php +++ b/src/Transformers/PrincipalComponentAnalysis.php @@ -53,7 +53,7 @@ class PrincipalComponentAnalysis implements Transformer, Stateful, Persistable * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $eigenvectors = null; + protected ?Matrix $eigenvectors = null; /** * The percentage of information lost due to the transformation. diff --git a/src/Transformers/TSNE.php b/src/Transformers/TSNE.php index b12407e4f..dc39961fb 100644 --- a/src/Transformers/TSNE.php +++ b/src/Transformers/TSNE.php @@ -190,7 +190,7 @@ class TSNE implements Transformer, Verbose * * @var Distance */ - protected \Rubix\ML\Kernels\Distance\Distance $kernel; + protected Distance $kernel; /** * The loss at each epoch from the last embedding. diff --git a/src/Transformers/TokenHashingVectorizer.php b/src/Transformers/TokenHashingVectorizer.php index ca8f7c56a..a0eb0d45b 100644 --- a/src/Transformers/TokenHashingVectorizer.php +++ b/src/Transformers/TokenHashingVectorizer.php @@ -70,7 +70,7 @@ class TokenHashingVectorizer implements Transformer * * @var Tokenizer */ - protected \Rubix\ML\Tokenizers\Tokenizer $tokenizer; + protected Tokenizer $tokenizer; /** * The hash function that accepts a string token and returns an integer. diff --git a/src/Transformers/TruncatedSVD.php b/src/Transformers/TruncatedSVD.php index 399bf7f05..143f570be 100644 --- a/src/Transformers/TruncatedSVD.php +++ b/src/Transformers/TruncatedSVD.php @@ -49,7 +49,7 @@ class TruncatedSVD implements Transformer, Stateful, Persistable * * @var \Tensor\Matrix|null */ - protected ?\Tensor\Matrix $components = null; + protected ?Matrix $components = null; /** * The proportion of information lost due to the transformation. diff --git a/src/Transformers/WordCountVectorizer.php b/src/Transformers/WordCountVectorizer.php index 3c79c9a7f..9545f560b 100644 --- a/src/Transformers/WordCountVectorizer.php +++ b/src/Transformers/WordCountVectorizer.php @@ -62,7 +62,7 @@ class WordCountVectorizer implements Transformer, Stateful, Persistable * * @var Tokenizer */ - protected \Rubix\ML\Tokenizers\Tokenizer $tokenizer; + protected Tokenizer $tokenizer; /** * The vocabularies of each categorical feature column of the fitted dataset. diff --git a/tests/Graph/Nodes/NeighborhoodTest.php b/tests/Graph/Nodes/NeighborhoodTest.php index d2f17fb91..755957c2f 100644 --- a/tests/Graph/Nodes/NeighborhoodTest.php +++ b/tests/Graph/Nodes/NeighborhoodTest.php @@ -63,7 +63,7 @@ public function terminate() : void { $node = Neighborhood::terminate(Labeled::quick(self::SAMPLES, self::LABELS)); - $this->assertInstanceOf(NeighborHood::class, $node); + $this->assertInstanceOf(Neighborhood::class, $node); $this->assertInstanceOf(Labeled::class, $node->dataset()); $this->assertEquals(self::BOX, iterator_to_array($node->sides())); } diff --git a/tests/NeuralNet/ParameterTest.php b/tests/NeuralNet/ParameterTest.php index 80fc03603..ec54adc51 100644 --- a/tests/NeuralNet/ParameterTest.php +++ b/tests/NeuralNet/ParameterTest.php @@ -16,7 +16,7 @@ class ParameterTest extends TestCase /** * @var Parameter */ - protected \Rubix\ML\NeuralNet\Parameter $param; + protected Parameter $param; /** * @var \Rubix\ML\NeuralNet\Optimizers\Optimizer diff --git a/tests/Transformers/ImageRotatorTest.php b/tests/Transformers/ImageRotatorTest.php index 5a88c0082..31297da76 100644 --- a/tests/Transformers/ImageRotatorTest.php +++ b/tests/Transformers/ImageRotatorTest.php @@ -17,7 +17,7 @@ class RandomizedImageRotatorTest extends TestCase /** * @var ImageRotator */ - protected \Rubix\ML\Transformers\ImageRotator $transformer; + protected ImageRotator $transformer; /** * @before