diff --git a/composer.json b/composer.json index d42c6091..eff93df0 100644 --- a/composer.json +++ b/composer.json @@ -24,10 +24,12 @@ "test:unit": "phpunit --config tests/phpunit.xml", "post-install-cmd": [ "@composer bin all install --ansi", + "vendor/bin/php-scoper add-prefix --prefix='OCA\\Recognize' --output-dir=\".\" --working-dir=\"./vendor/rubix/ml/\" -f --no-config", "composer dump-autoload" ], "post-update-cmd": [ "@composer bin all update --ansi", + "vendor/bin/php-scoper add-prefix --prefix='OCA\\Recognize' --output-dir=\".\" --working-dir=\"./vendor/rubix/ml/\" -f --no-config", "composer dump-autoload" ] }, diff --git a/lib/Clustering/DualTreeBall.php b/lib/Clustering/DualTreeBall.php index 6333c09e..b2e30242 100644 --- a/lib/Clustering/DualTreeBall.php +++ b/lib/Clustering/DualTreeBall.php @@ -6,11 +6,11 @@ declare(strict_types=1); namespace OCA\Recognize\Clustering; -use \Rubix\ML\Datasets\Labeled; -use \Rubix\ML\Graph\Nodes\Ball; -use \Rubix\ML\Helpers\Stats; -use \Rubix\ML\Kernels\Distance\Distance; -use function \Rubix\ML\argmax; +use \OCA\Recognize\Rubix\ML\Datasets\Labeled; +use \OCA\Recognize\Rubix\ML\Graph\Nodes\Ball; +use \OCA\Recognize\Rubix\ML\Helpers\Stats; +use \OCA\Recognize\Rubix\ML\Kernels\Distance\Distance; +use function \OCA\Recognize\Rubix\ML\argmax; class DualTreeBall extends Ball { protected float $longestDistanceInNode = INF; @@ -97,8 +97,8 @@ public function propagateSetChanges(array &$labelToSetId) { /** * Factory method to build a hypersphere by splitting the dataset into left and right clusters. * - * @param \Rubix\ML\Datasets\Labeled $dataset - * @param \Rubix\ML\Kernels\Distance\Distance $kernel + * @param \OCA\Recognize\Rubix\ML\Datasets\Labeled $dataset + * @param \OCA\Recognize\Rubix\ML\Kernels\Distance\Distance $kernel * @return self */ public static function split(Labeled $dataset, Distance $kernel): self { diff --git a/lib/Clustering/DualTreeClique.php b/lib/Clustering/DualTreeClique.php index 478907cc..0f540520 100644 --- a/lib/Clustering/DualTreeClique.php +++ b/lib/Clustering/DualTreeClique.php @@ -6,11 +6,11 @@ declare(strict_types=1); namespace OCA\Recognize\Clustering; -use \Rubix\ML\Datasets\Labeled; -use \Rubix\ML\Graph\Nodes\Clique; -use \Rubix\ML\Helpers\Stats; -use \Rubix\ML\Kernels\Distance\Distance; -use function \Rubix\ML\argmax; +use \OCA\Recognize\Rubix\ML\Datasets\Labeled; +use \OCA\Recognize\Rubix\ML\Graph\Nodes\Clique; +use \OCA\Recognize\Rubix\ML\Helpers\Stats; +use \OCA\Recognize\Rubix\ML\Kernels\Distance\Distance; +use function \OCA\Recognize\Rubix\ML\argmax; class DualTreeClique extends Clique { protected float $longestDistanceInNode = INF; @@ -80,8 +80,8 @@ public function propagateSetChanges(array &$labelToSetId) { /** * Terminate a branch with a dataset. * - * @param \Rubix\ML\Datasets\Labeled $dataset - * @param \Rubix\ML\Kernels\Distance\Distance $kernel + * @param \OCA\Recognize\Rubix\ML\Datasets\Labeled $dataset + * @param \OCA\Recognize\Rubix\ML\Kernels\Distance\Distance $kernel * @return self */ public static function terminate(Labeled $dataset, Distance $kernel): self { diff --git a/lib/Clustering/HDBSCAN.php b/lib/Clustering/HDBSCAN.php index e7ecb9e6..6e81b09f 100644 --- a/lib/Clustering/HDBSCAN.php +++ b/lib/Clustering/HDBSCAN.php @@ -6,10 +6,10 @@ declare(strict_types=1); namespace OCA\Recognize\Clustering; -use \Rubix\ML\Datasets\Labeled; -use \Rubix\ML\EstimatorType; -use \Rubix\ML\Helpers\Params; -use \Rubix\ML\Kernels\Distance\Distance; +use \OCA\Recognize\Rubix\ML\Datasets\Labeled; +use \OCA\Recognize\Rubix\ML\EstimatorType; +use \OCA\Recognize\Rubix\ML\Helpers\Params; +use \OCA\Recognize\Rubix\ML\Kernels\Distance\Distance; /** * HDBSCAN @@ -59,7 +59,7 @@ class HDBSCAN { * The distance kernel used for computing interpoint distances. * */ - protected \Rubix\ML\Datasets\Labeled $dataset; + protected \OCA\Recognize\Rubix\ML\Datasets\Labeled $dataset; @@ -70,7 +70,7 @@ class HDBSCAN { * @param array $oldCoreDistances * @param Distance $kernel * @param bool $useTrueMst // (Build true or approximate minimum spanning tree) - * @throws \Rubix\ML\Exceptions\InvalidArgumentException + * @throws \OCA\Recognize\Rubix\ML\Exceptions\InvalidArgumentException */ public function __construct(Labeled $dataset, int $minClusterSize = 5, int $sampleSize = 5, array $oldCoreDistances = [], ?Distance $kernel = null, bool $useTrueMst = true) { if ($minClusterSize < 2) { @@ -96,7 +96,7 @@ public function getCoreNeighborDistances(): array { /** * Return the estimator type. * - * @return \Rubix\ML\EstimatorType + * @return \OCA\Recognize\Rubix\ML\EstimatorType */ public function type(): EstimatorType { return EstimatorType::clusterer(); @@ -105,7 +105,7 @@ public function type(): EstimatorType { /** * Return the data types that the estimator is compatible with. * - * @return list<\Rubix\ML\DataType> + * @return list<\OCA\Recognize\Rubix\ML\DataType> */ public function compatibility(): array { return $this->mstSolver->kernel()->compatibility(); diff --git a/lib/Clustering/MrdBallTree.php b/lib/Clustering/MrdBallTree.php index 365175ad..3f08ad95 100644 --- a/lib/Clustering/MrdBallTree.php +++ b/lib/Clustering/MrdBallTree.php @@ -6,11 +6,11 @@ declare(strict_types=1); namespace OCA\Recognize\Clustering; -use \Rubix\ML\Datasets\Labeled; -use \Rubix\ML\Graph\Nodes\Ball; -use \Rubix\ML\Graph\Nodes\Hypersphere; -use \Rubix\ML\Graph\Trees\BallTree; -use \Rubix\ML\Kernels\Distance\Distance; +use \OCA\Recognize\Rubix\ML\Datasets\Labeled; +use \OCA\Recognize\Rubix\ML\Graph\Nodes\Ball; +use \OCA\Recognize\Rubix\ML\Graph\Nodes\Hypersphere; +use \OCA\Recognize\Rubix\ML\Graph\Trees\BallTree; +use \OCA\Recognize\Rubix\ML\Kernels\Distance\Distance; class MrdBallTree extends BallTree { private ?Labeled $dataset = null; @@ -25,8 +25,8 @@ class MrdBallTree extends BallTree { /** * @param int $maxLeafSize * @param int $coreDistSampleSize - * @param \Rubix\ML\Kernels\Distance\Distance|null $kernel - * @throws \Rubix\ML\Exceptions\InvalidArgumentException + * @param \OCA\Recognize\Rubix\ML\Kernels\Distance\Distance|null $kernel + * @throws \OCA\Recognize\Rubix\ML\Exceptions\InvalidArgumentException */ public function __construct(int $maxLeafSize = 30, int $sampleSize = 5, ?Distance $kernel = null) { if ($maxLeafSize < 1) { @@ -462,7 +462,7 @@ public function cachedComputeNative($a, array $a_vector, $b, array $b_vector, bo * * @param int|string $sampleLabel * @param bool $useCachedValues - * @throws \Rubix\ML\Exceptions\InvalidArgumentException + * @throws \OCA\Recognize\Rubix\ML\Exceptions\InvalidArgumentException * @return array{list,list} */ public function getCoreNeighbors($sampleLabel, bool $useCachedValues = true): array { @@ -546,8 +546,8 @@ public function getCoreNeighbors($sampleLabel, bool $useCachedValues = true): ar * * @param int $sampleLabel * @param float $radius - * @throws \Rubix\ML\Exceptions\InvalidArgumentException - * @throws \Rubix\ML\Exceptions\RuntimeException + * @throws \OCA\Recognize\Rubix\ML\Exceptions\InvalidArgumentException + * @throws \OCA\Recognize\Rubix\ML\Exceptions\RuntimeException * @return array{list,list} */ public function cachedRange($sampleLabel, float $radius): array { @@ -624,8 +624,8 @@ public function cachedRange($sampleLabel, float $radius): array { * * @internal * - * @param \Rubix\ML\Datasets\Labeled $dataset - * @throws \Rubix\ML\Exceptions\InvalidArgumentException + * @param \OCA\Recognize\Rubix\ML\Datasets\Labeled $dataset + * @throws \OCA\Recognize\Rubix\ML\Exceptions\InvalidArgumentException */ public function grow(Labeled $dataset): void { $this->dataset = $dataset; diff --git a/lib/Clustering/MstSolver.php b/lib/Clustering/MstSolver.php index 470270ea..f7c6b974 100644 --- a/lib/Clustering/MstSolver.php +++ b/lib/Clustering/MstSolver.php @@ -6,8 +6,8 @@ declare(strict_types=1); namespace OCA\Recognize\Clustering; -use \Rubix\ML\Datasets\Labeled; -use \Rubix\ML\Kernels\Distance\Distance; +use \OCA\Recognize\Rubix\ML\Datasets\Labeled; +use \OCA\Recognize\Rubix\ML\Kernels\Distance\Distance; class MstSolver { private MrdBallTree $tree; diff --git a/lib/Clustering/SquaredDistance.php b/lib/Clustering/SquaredDistance.php index 71c8bea7..ce6ca930 100644 --- a/lib/Clustering/SquaredDistance.php +++ b/lib/Clustering/SquaredDistance.php @@ -6,8 +6,8 @@ declare(strict_types=1); namespace OCA\Recognize\Clustering; -use \Rubix\ML\DataType; -use \Rubix\ML\Kernels\Distance\Distance; +use \OCA\Recognize\Rubix\ML\DataType; +use \OCA\Recognize\Rubix\ML\Kernels\Distance\Distance; /** * Squared distance @@ -24,7 +24,7 @@ class SquaredDistance implements Distance { * * @internal * - * @return list<\Rubix\ML\DataType> + * @return list<\OCA\Recognize\Rubix\ML\DataType> */ public function compatibility(): array { return [ diff --git a/lib/Dav/Faces/FacePhoto.php b/lib/Dav/Faces/FacePhoto.php index b8111200..71f82a10 100644 --- a/lib/Dav/Faces/FacePhoto.php +++ b/lib/Dav/Faces/FacePhoto.php @@ -6,7 +6,7 @@ declare(strict_types=1); namespace OCA\Recognize\Dav\Faces; -use \Rubix\ML\Kernels\Distance\Euclidean; +use \OCA\Recognize\Rubix\ML\Kernels\Distance\Euclidean; use OCA\Recognize\Db\FaceDetection; use OCA\Recognize\Db\FaceDetectionMapper; use OCA\Recognize\Service\FaceClusterAnalyzer; diff --git a/lib/Service/FaceClusterAnalyzer.php b/lib/Service/FaceClusterAnalyzer.php index 44fd0f1e..43ceb1c0 100644 --- a/lib/Service/FaceClusterAnalyzer.php +++ b/lib/Service/FaceClusterAnalyzer.php @@ -6,8 +6,8 @@ declare(strict_types=1); namespace OCA\Recognize\Service; -use \Rubix\ML\Datasets\Labeled; -use \Rubix\ML\Kernels\Distance\Euclidean; +use \OCA\Recognize\Rubix\ML\Datasets\Labeled; +use \OCA\Recognize\Rubix\ML\Kernels\Distance\Euclidean; use OCA\Recognize\Clustering\HDBSCAN; use OCA\Recognize\Db\FaceCluster; use OCA\Recognize\Db\FaceClusterMapper; diff --git a/tests/ClusterTest.php b/tests/ClusterTest.php index b7f8d7a7..b27a2eed 100644 --- a/tests/ClusterTest.php +++ b/tests/ClusterTest.php @@ -1,6 +1,6 @@