Skip to content

Commit

Permalink
Update dependencies and fix coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdalpino committed May 6, 2024
1 parent e330fc7 commit 6e81fdf
Show file tree
Hide file tree
Showing 58 changed files with 123 additions and 116 deletions.
7 changes: 7 additions & 0 deletions docs/persisters/filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ use Rubix\ML\Classifiers\KNearestNeighbors;
use Rubix\ML\Kernels\Distance\Manhattan;

$persistable = new KNearestNeighbors(3, false, new Manhattan());

$persister = new Filesystem('/path/to/example.rbx', true);

$serializer = new RBX(6);

$encoding = $serializer->serialize($persistable);

$persister->save($encoding);
```

Expand All @@ -29,8 +33,11 @@ use Rubix\ML\Persisters\Filesystem;
use Rubix\ML\Serializers\RBX;

$persister = new Filesystem('/path/to/example.rbx', true);

$encoding = $persister->load();

$serializer = new RBX(6);

$persistable = $serializer->deserialize($encoding);
```

Expand Down
2 changes: 1 addition & 1 deletion src/AnomalyDetectors/LocalOutlierFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class LocalOutlierFactor implements Estimator, Learner, Scoring, Persistable
/**
* @param int $k
* @param float|null $contamination
* @param \Rubix\ML\Graph\Trees\Spatial|null $tree
* @param Spatial|null $tree
* @throws InvalidArgumentException
*/
public function __construct(int $k = 20, ?float $contamination = null, ?Spatial $tree = null)
Expand Down
2 changes: 1 addition & 1 deletion src/AnomalyDetectors/Loda.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Loda implements Estimator, Learner, Online, Scoring, Persistable
/**
* The sparse random projection matrix.
*
* @var \Tensor\Matrix|null
* @var Matrix|null
*/
protected ?Matrix $r = null;

Expand Down
4 changes: 2 additions & 2 deletions src/AnomalyDetectors/OneClassSVM.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ class OneClassSVM implements Estimator, Learner
/**
* The trained model instance.
*
* @var \svmmodel|null
* @var svmmodel|null
*/
protected ?svmmodel $model = null;

/**
* @param float $nu
* @param \Rubix\ML\Kernels\SVM\Kernel|null $kernel
* @param Kernel|null $kernel
* @param bool $shrinking
* @param float $tolerance
* @param float $cacheSize
Expand Down
2 changes: 1 addition & 1 deletion src/Classifiers/AdaBoost.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class AdaBoost implements Estimator, Learner, Probabilistic, Verbose, Persistabl
protected ?int $featureCount = null;

/**
* @param \Rubix\ML\Learner|null $base
* @param Learner|null $base
* @param float $rate
* @param float $ratio
* @param int $epochs
Expand Down
2 changes: 1 addition & 1 deletion src/Classifiers/KDNeighbors.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class KDNeighbors implements Estimator, Learner, Probabilistic, Persistable
/**
* @param int $k
* @param bool $weighted
* @param \Rubix\ML\Graph\Trees\Spatial|null $tree
* @param Spatial|null $tree
* @throws InvalidArgumentException
*/
public function __construct(int $k = 5, bool $weighted = false, ?Spatial $tree = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Classifiers/KNearestNeighbors.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class KNearestNeighbors implements Estimator, Learner, Online, Probabilistic, Pe
/**
* @param int $k
* @param bool $weighted
* @param \Rubix\ML\Kernels\Distance\Distance|null $kernel
* @param Distance|null $kernel
* @throws InvalidArgumentException
*/
public function __construct(int $k = 5, bool $weighted = false, ?Distance $kernel = null)
Expand Down
8 changes: 4 additions & 4 deletions src/Classifiers/LogisticRegression.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class LogisticRegression implements Estimator, Learner, Online, Probabilistic, R
/**
* The underlying neural network instance.
*
* @var \Rubix\ML\NeuralNet\FeedForward|null
* @var FeedForward|null
*/
protected ?FeedForward $network = null;

Expand All @@ -128,12 +128,12 @@ class LogisticRegression implements Estimator, Learner, Online, Probabilistic, R

/**
* @param int $batchSize
* @param \Rubix\ML\NeuralNet\Optimizers\Optimizer|null $optimizer
* @param Optimizer|null $optimizer
* @param float $l2Penalty
* @param int $epochs
* @param float $minChange
* @param int $window
* @param \Rubix\ML\NeuralNet\CostFunctions\ClassificationLoss|null $costFn
* @param ClassificationLoss|null $costFn
* @throws InvalidArgumentException
*/
public function __construct(
Expand Down Expand Up @@ -267,7 +267,7 @@ public function losses() : ?array
/**
* Return the underlying neural network instance or null if not trained.
*
* @return \Rubix\ML\NeuralNet\FeedForward|null
* @return FeedForward|null
*/
public function network() : ?FeedForward
{
Expand Down
4 changes: 2 additions & 2 deletions src/Classifiers/LogitBoost.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ class LogitBoost implements Estimator, Learner, Probabilistic, RanksFeatures, Ve
protected ?int $featureCount = null;

/**
* @param \Rubix\ML\Learner|null $booster
* @param Learner|null $booster
* @param float $rate
* @param float $ratio
* @param int $epochs
* @param float $minChange
* @param int $window
* @param float $holdOut
* @param \Rubix\ML\CrossValidation\Metrics\Metric|null $metric
* @param Metric|null $metric
* @throws InvalidArgumentException
*/
public function __construct(
Expand Down
10 changes: 5 additions & 5 deletions src/Classifiers/MultilayerPerceptron.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class MultilayerPerceptron implements Estimator, Learner, Online, Probabilistic,
/**
* The underlying neural network instance.
*
* @var \Rubix\ML\NeuralNet\FeedForward|null
* @var FeedForward|null
*/
protected ?FeedForward $network = null;

Expand Down Expand Up @@ -167,14 +167,14 @@ class MultilayerPerceptron implements Estimator, Learner, Online, Probabilistic,
/**
* @param \Rubix\ML\NeuralNet\Layers\Hidden[] $hiddenLayers
* @param int $batchSize
* @param \Rubix\ML\NeuralNet\Optimizers\Optimizer|null $optimizer
* @param Optimizer|null $optimizer
* @param float $l2Penalty
* @param int $epochs
* @param float $minChange
* @param int $window
* @param float $holdOut
* @param \Rubix\ML\NeuralNet\CostFunctions\ClassificationLoss|null $costFn
* @param \Rubix\ML\CrossValidation\Metrics\Metric|null $metric
* @param ClassificationLoss|null $costFn
* @param Metric|null $metric
* @throws InvalidArgumentException
*/
public function __construct(
Expand Down Expand Up @@ -344,7 +344,7 @@ public function losses() : ?array
/**
* Return the underlying neural network instance or null if not trained.
*
* @return \Rubix\ML\NeuralNet\FeedForward|null
* @return FeedForward|null
*/
public function network() : ?FeedForward
{
Expand Down
2 changes: 1 addition & 1 deletion src/Classifiers/RadiusNeighbors.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class RadiusNeighbors implements Estimator, Learner, Probabilistic, Persistable
* @param float $radius
* @param bool $weighted
* @param string $outlierClass
* @param \Rubix\ML\Graph\Trees\Spatial|null $tree
* @param Spatial|null $tree
* @throws InvalidArgumentException
*/
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/Classifiers/RandomForest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class RandomForest implements Estimator, Learner, Probabilistic, Parallel, Ranks
protected ?int $featureCount = null;

/**
* @param \Rubix\ML\Learner|null $base
* @param Learner|null $base
* @param int $estimators
* @param float $ratio
* @param bool $balanced
Expand Down
4 changes: 2 additions & 2 deletions src/Classifiers/SVC.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SVC implements Estimator, Learner
/**
* The trained model instance.
*
* @var \svmmodel|null
* @var svmmodel|null
*/
protected $model;

Expand All @@ -73,7 +73,7 @@ class SVC implements Estimator, Learner

/**
* @param float $c
* @param \Rubix\ML\Kernels\SVM\Kernel|null $kernel
* @param Kernel|null $kernel
* @param bool $shrinking
* @param float $tolerance
* @param float $cacheSize
Expand Down
8 changes: 4 additions & 4 deletions src/Classifiers/SoftmaxClassifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class SoftmaxClassifier implements Estimator, Learner, Online, Probabilistic, Ve
/**
* The underlying neural network instance.
*
* @var \Rubix\ML\NeuralNet\FeedForward|null
* @var FeedForward|null
*/
protected ?FeedForward $network = null;

Expand All @@ -124,12 +124,12 @@ class SoftmaxClassifier implements Estimator, Learner, Online, Probabilistic, Ve

/**
* @param int $batchSize
* @param \Rubix\ML\NeuralNet\Optimizers\Optimizer|null $optimizer
* @param Optimizer|null $optimizer
* @param float $l2Penalty
* @param int $epochs
* @param float $minChange
* @param int $window
* @param \Rubix\ML\NeuralNet\CostFunctions\ClassificationLoss|null $costFn
* @param ClassificationLoss|null $costFn
* @throws InvalidArgumentException
*/
public function __construct(
Expand Down Expand Up @@ -263,7 +263,7 @@ public function losses() : ?array
/**
* Return the underlying neural network instance or null if not trained.
*
* @return \Rubix\ML\NeuralNet\FeedForward|null
* @return FeedForward|null
*/
public function network() : ?FeedForward
{
Expand Down
2 changes: 1 addition & 1 deletion src/Clusterers/DBSCAN.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class DBSCAN implements Estimator
/**
* @param float $radius
* @param int $minDensity
* @param \Rubix\ML\Graph\Trees\Spatial|null $tree
* @param Spatial|null $tree
* @throws InvalidArgumentException
*/
public function __construct(float $radius = 0.5, int $minDensity = 5, ?Spatial $tree = null)
Expand Down
4 changes: 2 additions & 2 deletions src/Clusterers/FuzzyCMeans.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ class FuzzyCMeans implements Estimator, Learner, Probabilistic, Verbose, Persist
* @param float $fuzz
* @param int $epochs
* @param float $minChange
* @param \Rubix\ML\Kernels\Distance\Distance|null $kernel
* @param Seeders\Seeder|null $seeder
* @param Distance|null $kernel
* @param Seeder|null $seeder
* @throws InvalidArgumentException
*/
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/Clusterers/GaussianMixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class GaussianMixture implements Estimator, Learner, Probabilistic, Verbose, Per
* @param float $smoothing
* @param int $epochs
* @param float $minChange
* @param Seeders\Seeder|null $seeder
* @param Seeder|null $seeder
* @throws InvalidArgumentException
*/
public function __construct(
Expand Down
4 changes: 2 additions & 2 deletions src/Clusterers/KMeans.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ class KMeans implements Estimator, Learner, Online, Probabilistic, Verbose, Pers
* @param int $epochs
* @param float $minChange
* @param int $window
* @param \Rubix\ML\Kernels\Distance\Distance|null $kernel
* @param Seeders\Seeder|null $seeder
* @param Distance|null $kernel
* @param Seeder|null $seeder
* @throws InvalidArgumentException
*/
public function __construct(
Expand Down
6 changes: 3 additions & 3 deletions src/Clusterers/MeanShift.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class MeanShift implements Estimator, Learner, Probabilistic, Verbose, Persistab
*
* @param Dataset $dataset
* @param float $percentile
* @param \Rubix\ML\Kernels\Distance\Distance|null $kernel
* @param Distance|null $kernel
* @throws InvalidArgumentException
* @return float
*/
Expand Down Expand Up @@ -175,8 +175,8 @@ public static function estimateRadius(
* @param float $ratio
* @param int $epochs
* @param float $minShift
* @param \Rubix\ML\Graph\Trees\Spatial|null $tree
* @param Seeders\Seeder|null $seeder
* @param Spatial|null $tree
* @param Seeder|null $seeder
* @throws InvalidArgumentException
*/
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/Clusterers/Seeders/KMC2.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class KMC2 implements Seeder

/**
* @param int $m
* @param \Rubix\ML\Kernels\Distance\Distance|null $kernel
* @param Distance|null $kernel
* @throws InvalidArgumentException
*/
public function __construct(int $m = 50, ?Distance $kernel = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Clusterers/Seeders/PlusPlus.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PlusPlus implements Seeder
protected Distance $kernel;

/**
* @param \Rubix\ML\Kernels\Distance\Distance|null $kernel
* @param Distance|null $kernel
*/
public function __construct(?Distance $kernel = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Datasets/Generators/Blob.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Blob implements Generator
/**
* The standard deviation of the blob.
*
* @var \Tensor\Vector|int|float
* @var Vector|int|float
*/
protected $stdDev;

Expand Down
12 changes: 6 additions & 6 deletions src/Graph/Nodes/Traits/HasBinaryChildrenTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ trait HasBinaryChildrenTrait
/**
* The left child node.
*
* @var \Rubix\ML\Graph\Nodes\BinaryNode|null
* @var BinaryNode|null
*/
protected ?BinaryNode $left = null;

/**
* The right child node.
*
* @var \Rubix\ML\Graph\Nodes\BinaryNode|null
* @var BinaryNode|null
*/
protected ?BinaryNode $right = null;

Expand All @@ -51,7 +51,7 @@ public function children() : Traversable
/**
* Return the left child node.
*
* @return \Rubix\ML\Graph\Nodes\BinaryNode|null
* @return BinaryNode|null
*/
public function left() : ?BinaryNode
{
Expand All @@ -61,7 +61,7 @@ public function left() : ?BinaryNode
/**
* Return the right child node.
*
* @return \Rubix\ML\Graph\Nodes\BinaryNode|null
* @return BinaryNode|null
*/
public function right() : ?BinaryNode
{
Expand Down Expand Up @@ -95,7 +95,7 @@ public function balance() : int
/**
* Set the left child node.
*
* @param \Rubix\ML\Graph\Nodes\BinaryNode|null $node
* @param BinaryNode|null $node
*/
public function attachLeft(?BinaryNode $node = null) : void
{
Expand All @@ -105,7 +105,7 @@ public function attachLeft(?BinaryNode $node = null) : void
/**
* Set the right child node.
*
* @param \Rubix\ML\Graph\Nodes\BinaryNode|null $node
* @param BinaryNode|null $node
*/
public function attachRight(?BinaryNode $node = null) : void
{
Expand Down
4 changes: 2 additions & 2 deletions src/Graph/Trees/BallTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class BallTree implements BinaryTree, Spatial
/**
* The root node of the tree.
*
* @var \Rubix\ML\Graph\Nodes\Ball|null
* @var Ball|null
*/
protected ?Ball $root = null;

/**
* @param int $maxLeafSize
* @param \Rubix\ML\Kernels\Distance\Distance|null $kernel
* @param Distance|null $kernel
* @throws InvalidArgumentException
*/
public function __construct(int $maxLeafSize = 30, ?Distance $kernel = null)
Expand Down
Loading

0 comments on commit 6e81fdf

Please sign in to comment.