diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c16213c7..707a5742c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ - 2.5.0 - Added Vantage Point Spatial tree - Blob Generator can now `simulate()` a Dataset object + - Added Wrapper interface + - Added Swoole Backend + - Plus Plus added check for min number of sample seeds - 2.4.1 - Sentence Tokenizer fix Arabic and Farsi language support 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..aeb2eb812 100644 --- a/src/Clusterers/Seeders/PlusPlus.php +++ b/src/Clusterers/Seeders/PlusPlus.php @@ -6,6 +6,7 @@ use Rubix\ML\Kernels\Distance\Distance; use Rubix\ML\Kernels\Distance\Euclidean; use Rubix\ML\Specifications\DatasetIsNotEmpty; +use Rubix\ML\Exceptions\RuntimeException; use function count; @@ -32,7 +33,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 @@ -49,12 +50,18 @@ public function __construct(?Distance $kernel = null) * * @param Dataset $dataset * @param int $k + * @throws RuntimeException * @return list> */ public function seed(Dataset $dataset, int $k) : array { DatasetIsNotEmpty::with($dataset)->check(); + if ($k > $dataset->numSamples()) { + throw new RuntimeException("Cannot seed $k clusters with only " + . $dataset->numSamples() . ' samples.'); + } + $centroids = $dataset->randomSubset(1)->samples(); while (count($centroids) < $k) { diff --git a/src/Datasets/Generators/Blob.php b/src/Datasets/Generators/Blob.php index 994d6fa52..62f703ae6 100644 --- a/src/Datasets/Generators/Blob.php +++ b/src/Datasets/Generators/Blob.php @@ -32,7 +32,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 42ab7f3a3..71adcb361 100644 --- a/src/GridSearch.php +++ b/src/GridSearch.php @@ -62,21 +62,21 @@ class GridSearch implements Estimator, Learner, Parallel, Verbose, Persistable * * @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 a7964a8a7..ceb3880bc 100644 --- a/src/PersistentModel.php +++ b/src/PersistentModel.php @@ -28,21 +28,21 @@ class PersistentModel implements Estimator, Learner, Probabilistic, Scoring * * @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 7a04e080c..62abc5c9b 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -43,7 +43,7 @@ class Pipeline implements Online, Probabilistic, Scoring, Persistable * * @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