mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-10 17:28:40 +00:00
commit
250f64556d
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
|
@ -3,7 +3,7 @@ name: CI
|
|||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
general_module_workflow:
|
||||
general_module_workflow_php:
|
||||
uses: Karaka-Management/Karaka/.github/workflows/php_template.yml@develop
|
||||
secrets:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Ai\NeuralNetwork
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Ai\Ocr
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Ai\Ocr\Tesseract
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -22,244 +22,9 @@ namespace phpOMS\Algorithm\Clustering;
|
|||
* @link https://jingga.app
|
||||
* @see ./clustering_overview.png
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @todo Implement
|
||||
*/
|
||||
final class AffinityPropagation implements ClusteringInterface
|
||||
final class AffinityPropagation
|
||||
{
|
||||
/**
|
||||
* Points of the cluster centers
|
||||
*
|
||||
* @var PointInterface[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $clusterCenters = [];
|
||||
|
||||
/**
|
||||
* Cluster points
|
||||
*
|
||||
* Points in clusters (helper to avoid looping the cluster array)
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $clusters = [];
|
||||
|
||||
private array $similarityMatrix = [];
|
||||
|
||||
private array $responsibilityMatrix = [];
|
||||
|
||||
private array $availabilityMatrix = [];
|
||||
|
||||
/**
|
||||
* Original points used for clusters
|
||||
*
|
||||
* @var PointInterface[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $points = [];
|
||||
|
||||
/**
|
||||
* Create similarity matrix from points
|
||||
*
|
||||
* @param PointInterface[] $points Points to create the similarity matrix for
|
||||
*
|
||||
* @return array<int, array<int, int|float>>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createSimilarityMatrix(array $points) : array
|
||||
{
|
||||
$n = \count($points);
|
||||
$coordinates = \count($points[0]->coordinates);
|
||||
$similarityMatrix = \array_fill(0, $n, []);
|
||||
|
||||
$temp = [];
|
||||
for ($i = 0; $i < $n - 1; ++$i) {
|
||||
for ($j = $i + 1; $j < $n; ++$j) {
|
||||
$sum = 0.0;
|
||||
for ($c = 0; $c < $coordinates; ++$c) {
|
||||
$sum += ($points[$i]->getCoordinate($c) - $points[$j]->getCoordinate($c)) * ($points[$i]->getCoordinate($c) - $points[$j]->getCoordinate($c));
|
||||
}
|
||||
|
||||
$similarityMatrix[$i][$j] = -$sum;
|
||||
$similarityMatrix[$j][$i] = -$sum;
|
||||
$temp[] = $similarityMatrix[$i][$j];
|
||||
}
|
||||
}
|
||||
|
||||
\sort($temp);
|
||||
|
||||
$size = $n * ($n - 1) / 2;
|
||||
$median = $size % 2 === 0
|
||||
? ($temp[(int) ($size / 2)] + $temp[(int) ($size / 2 - 1)]) / 2
|
||||
: $temp[(int) ($size / 2)];
|
||||
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$similarityMatrix[$i][$i] = $median;
|
||||
}
|
||||
|
||||
return $similarityMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate clusters for points
|
||||
*
|
||||
* @param PointInterface[] $points Points to cluster
|
||||
* @param int $iterations Iterations for cluster generation
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function generateClusters(array $points, int $iterations = 100) : void
|
||||
{
|
||||
$this->points = $points;
|
||||
$n = \count($points);
|
||||
|
||||
$this->similarityMatrix = $this->createSimilarityMatrix($points);
|
||||
$this->responsibilityMatrix = $this->similarityMatrix;
|
||||
$this->availabilityMatrix = $this->similarityMatrix;
|
||||
|
||||
for ($c = 0; $c < $iterations; ++$c) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
for ($k = 0; $k < $n; ++$k) {
|
||||
$max = \PHP_INT_MIN;
|
||||
for ($j = 0; $j < $k; ++$j) {
|
||||
if (($temp = $this->similarityMatrix[$i][$j] + $this->availabilityMatrix[$i][$j]) > $max) {
|
||||
$max = $temp;
|
||||
}
|
||||
}
|
||||
|
||||
for ($j = $k + 1; $j < $n; ++$j) {
|
||||
if (($temp = $this->similarityMatrix[$i][$j] + $this->availabilityMatrix[$i][$j]) > $max) {
|
||||
$max = $temp;
|
||||
}
|
||||
}
|
||||
|
||||
$this->responsibilityMatrix[$i][$k] = (1 - 0.9) * ($this->similarityMatrix[$i][$k] - $max) + 0.9 * $this->responsibilityMatrix[$i][$k];
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
for ($k = 0; $k < $n; ++$k) {
|
||||
$sum = 0.0;
|
||||
|
||||
if ($i === $k) {
|
||||
for ($j = 0; $j < $i; ++$j) {
|
||||
$sum += \max(0.0, $this->responsibilityMatrix[$j][$k]);
|
||||
}
|
||||
|
||||
for (++$j; $j < $n; ++$j) {
|
||||
$sum += \max(0.0, $this->responsibilityMatrix[$j][$k]);
|
||||
}
|
||||
|
||||
$this->availabilityMatrix[$i][$k] = (1 - 0.9) * $sum + 0.9 * $this->availabilityMatrix[$i][$k];
|
||||
} else {
|
||||
$max = \max($i, $k);
|
||||
$min = \min($i, $k);
|
||||
|
||||
for ($j = 0; $j < $min; ++$j) {
|
||||
$sum += \max(0.0, $this->responsibilityMatrix[$j][$k]);
|
||||
}
|
||||
|
||||
for ($j = $min + 1; $j < $max; ++$j) {
|
||||
$sum += \max(0.0, $this->responsibilityMatrix[$j][$k]);
|
||||
}
|
||||
|
||||
for ($j = $max + 1; $j < $n; ++$j) {
|
||||
$sum += \max(0.0, $this->responsibilityMatrix[$j][$k]);
|
||||
}
|
||||
|
||||
$this->availabilityMatrix[$i][$k] = (1 - 0.9) * \min(0.0, $this->responsibilityMatrix[$k][$k] + $sum) + 0.9 * $this->availabilityMatrix[$i][$k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// find center points (exemplar)
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$temp = $this->responsibilityMatrix[$i][$i] + $this->availabilityMatrix[$i][$i];
|
||||
|
||||
if ($temp > 0) {
|
||||
$this->clusterCenters[$i] = $this->points[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the nearest group for a point
|
||||
*
|
||||
* @param array<int, array<int, int|float>> $similarityMatrix Similarity matrix
|
||||
* @param int $point Point id in the similarity matrix to compare
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function findNearestGroup(array $similarityMatrix, int $point) : int
|
||||
{
|
||||
$maxSim = \PHP_INT_MIN;
|
||||
$group = 0;
|
||||
|
||||
foreach ($this->clusterCenters as $c => $_) {
|
||||
if ($similarityMatrix[$point][$c] > $maxSim) {
|
||||
$maxSim = $similarityMatrix[$point][$c];
|
||||
$group = $c;
|
||||
}
|
||||
}
|
||||
|
||||
return $group;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cluster(PointInterface $point) : ?PointInterface
|
||||
{
|
||||
$points = $this->points;
|
||||
$points[] = $point;
|
||||
|
||||
$similarityMatrix = $this->createSimilarityMatrix($points);
|
||||
|
||||
$c = $this->findNearestGroup(
|
||||
$similarityMatrix,
|
||||
\count($points) - 1,
|
||||
);
|
||||
|
||||
return $this->clusterCenters[$c];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getClusters() : array
|
||||
{
|
||||
if (!empty($this->clusters)) {
|
||||
return $this->clusters;
|
||||
}
|
||||
|
||||
$n = \count($this->points);
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$group = $this->findNearestGroup($this->points, $i);
|
||||
|
||||
$this->clusters[$group] = $this->points[$i];
|
||||
}
|
||||
|
||||
return $this->clusters;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCentroids() : array
|
||||
{
|
||||
return $this->clusterCenters;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNoise() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -42,7 +42,7 @@ final class AgglomerativeClustering implements ClusteringInterface
|
|||
* @var \Closure
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private \Closure $metric;
|
||||
public \Closure $metric;
|
||||
|
||||
/**
|
||||
* Metric to calculate the distance between two points
|
||||
|
|
@ -50,7 +50,7 @@ final class AgglomerativeClustering implements ClusteringInterface
|
|||
* @var \Closure
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private \Closure $linkage;
|
||||
public \Closure $linkage;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -61,7 +61,7 @@ final class AgglomerativeClustering implements ClusteringInterface
|
|||
*/
|
||||
public function __construct(?\Closure $metric = null, ?\Closure $linkage = null)
|
||||
{
|
||||
$this->metric = $metric ?? function (PointInterface $a, PointInterface $b) {
|
||||
$this->metric = $metric ?? function (Point $a, Point $b) {
|
||||
$aCoordinates = $a->coordinates;
|
||||
$bCoordinates = $b->coordinates;
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ final class AgglomerativeClustering implements ClusteringInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cluster(PointInterface $point) : ?PointInterface
|
||||
public function cluster(Point $point) : ?Point
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -46,7 +46,7 @@ final class Birch implements ClusteringInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cluster(PointInterface $point) : ?PointInterface
|
||||
public function cluster(Point $point) : ?Point
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -27,7 +27,7 @@ interface ClusteringInterface
|
|||
/**
|
||||
* Get cluster centroids
|
||||
*
|
||||
* @return PointInterface[]
|
||||
* @return Point[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -36,7 +36,7 @@ interface ClusteringInterface
|
|||
/**
|
||||
* Get cluster assignments of the training data
|
||||
*
|
||||
* @return PointInterface[]
|
||||
* @return Point[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -47,20 +47,20 @@ interface ClusteringInterface
|
|||
*
|
||||
* This point doesn't have to be in the training data.
|
||||
*
|
||||
* @param PointInterface $point Point to cluster
|
||||
* @param Point $point Point to cluster
|
||||
*
|
||||
* @return null|PointInterface
|
||||
* @return null|Point
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function cluster(PointInterface $point) : ?PointInterface;
|
||||
public function cluster(Point $point) : ?Point;
|
||||
|
||||
/**
|
||||
* Get noise data.
|
||||
*
|
||||
* Data points from the training data that are not part of a cluster.
|
||||
*
|
||||
* @return PointInterface[]
|
||||
* @return Point[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -50,7 +50,7 @@ final class DBSCAN implements ClusteringInterface
|
|||
/**
|
||||
* Points outside of any cluster
|
||||
*
|
||||
* @var PointInterface[]
|
||||
* @var Point[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $noisePoints = [];
|
||||
|
|
@ -58,7 +58,7 @@ final class DBSCAN implements ClusteringInterface
|
|||
/**
|
||||
* All points
|
||||
*
|
||||
* @var PointInterface[]
|
||||
* @var Point[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $points = [];
|
||||
|
|
@ -66,7 +66,7 @@ final class DBSCAN implements ClusteringInterface
|
|||
/**
|
||||
* Points of the cluster centers
|
||||
*
|
||||
* @var PointInterface[]
|
||||
* @var Point[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $clusterCenters = [];
|
||||
|
|
@ -76,7 +76,7 @@ final class DBSCAN implements ClusteringInterface
|
|||
*
|
||||
* Array of points assigned to a cluster
|
||||
*
|
||||
* @var array<int, PointInterface[]>
|
||||
* @var array<int, Point[]>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $clusters = [];
|
||||
|
|
@ -118,7 +118,7 @@ final class DBSCAN implements ClusteringInterface
|
|||
*/
|
||||
public function __construct(?\Closure $metric = null)
|
||||
{
|
||||
$this->metric = $metric ?? function (PointInterface $a, PointInterface $b) {
|
||||
$this->metric = $metric ?? function (Point $a, Point $b) {
|
||||
$aCoordinates = $a->coordinates;
|
||||
$bCoordinates = $b->coordinates;
|
||||
|
||||
|
|
@ -129,18 +129,18 @@ final class DBSCAN implements ClusteringInterface
|
|||
/**
|
||||
* Expand cluster with additional point and potential neighbors.
|
||||
*
|
||||
* @param PointInterface $point Point to add to a cluster
|
||||
* @param array $neighbors Neighbors of point
|
||||
* @param int $c Cluster id
|
||||
* @param float $epsilon Max distance
|
||||
* @param int $minPoints Min amount of points required for a cluster
|
||||
* @param Point $point Point to add to a cluster
|
||||
* @param array $neighbors Neighbors of point
|
||||
* @param int $c Cluster id
|
||||
* @param float $epsilon Max distance
|
||||
* @param int $minPoints Min amount of points required for a cluster
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function expandCluster(
|
||||
PointInterface $point,
|
||||
Point $point,
|
||||
array $neighbors,
|
||||
int $c,
|
||||
float $epsilon,
|
||||
|
|
@ -174,14 +174,14 @@ final class DBSCAN implements ClusteringInterface
|
|||
/**
|
||||
* Find neighbors of a point
|
||||
*
|
||||
* @param PointInterface $point Base point for potential neighbors
|
||||
* @param float $epsilon Max distance to neighbor
|
||||
* @param Point $point Base point for potential neighbors
|
||||
* @param float $epsilon Max distance to neighbor
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function findNeighbors(PointInterface $point, float $epsilon) : array
|
||||
private function findNeighbors(Point $point, float $epsilon) : array
|
||||
{
|
||||
$neighbors = [];
|
||||
foreach ($this->points as $point2) {
|
||||
|
|
@ -225,7 +225,7 @@ final class DBSCAN implements ClusteringInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cluster(PointInterface $point) : ?PointInterface
|
||||
public function cluster(Point $point) : ?Point
|
||||
{
|
||||
if ($this->convexHulls === []) {
|
||||
foreach ($this->clusters as $c => $cluster) {
|
||||
|
|
@ -251,9 +251,9 @@ final class DBSCAN implements ClusteringInterface
|
|||
/**
|
||||
* Generate the clusters of the points
|
||||
*
|
||||
* @param PointInterface[] $points Points to cluster
|
||||
* @param float $epsilon Max distance
|
||||
* @param int $minPoints Min amount of points required for a cluster
|
||||
* @param Point[] $points Points to cluster
|
||||
* @param float $epsilon Max distance
|
||||
* @param int $minPoints Min amount of points required for a cluster
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -50,7 +50,7 @@ final class DivisiveClustering implements ClusteringInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cluster(PointInterface $point) : ?PointInterface
|
||||
public function cluster(Point $point) : ?Point
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -46,7 +46,7 @@ final class Kmeans implements ClusteringInterface
|
|||
/**
|
||||
* Points of the cluster centers
|
||||
*
|
||||
* @var PointInterface[]
|
||||
* @var Point[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $clusterCenters = [];
|
||||
|
|
@ -54,7 +54,7 @@ final class Kmeans implements ClusteringInterface
|
|||
/**
|
||||
* Points of the clusters
|
||||
*
|
||||
* @var PointInterface[]
|
||||
* @var Point[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $clusters = [];
|
||||
|
|
@ -62,7 +62,7 @@ final class Kmeans implements ClusteringInterface
|
|||
/**
|
||||
* Points
|
||||
*
|
||||
* @var PointInterface[]
|
||||
* @var Point[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $points = [];
|
||||
|
|
@ -76,7 +76,7 @@ final class Kmeans implements ClusteringInterface
|
|||
*/
|
||||
public function __construct(?\Closure $metric = null)
|
||||
{
|
||||
$this->metric = $metric ?? function (PointInterface $a, PointInterface $b) {
|
||||
$this->metric = $metric ?? function (Point $a, Point $b) {
|
||||
$aCoordinates = $a->coordinates;
|
||||
$bCoordinates = $b->coordinates;
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ final class Kmeans implements ClusteringInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cluster(PointInterface $point) : ?PointInterface
|
||||
public function cluster(Point $point) : ?Point
|
||||
{
|
||||
$bestCluster = null;
|
||||
$bestDistance = \PHP_FLOAT_MAX;
|
||||
|
|
@ -121,8 +121,8 @@ final class Kmeans implements ClusteringInterface
|
|||
/**
|
||||
* Generate the clusters of the points
|
||||
*
|
||||
* @param PointInterface[] $points Points to cluster
|
||||
* @param int<1, max> $clusters Amount of clusters
|
||||
* @param Point[] $points Points to cluster
|
||||
* @param int<1, max> $clusters Amount of clusters
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -183,14 +183,14 @@ final class Kmeans implements ClusteringInterface
|
|||
/**
|
||||
* Get the index and distance to the nearest cluster center
|
||||
*
|
||||
* @param PointInterface $point Point to get the cluster for
|
||||
* @param PointInterface[] $clusterCenters All cluster centers
|
||||
* @param Point $point Point to get the cluster for
|
||||
* @param Point[] $clusterCenters All cluster centers
|
||||
*
|
||||
* @return array [index, distance]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function nearestClusterCenter(PointInterface $point, array $clusterCenters) : array
|
||||
private function nearestClusterCenter(Point $point, array $clusterCenters) : array
|
||||
{
|
||||
$index = $point->group;
|
||||
$dist = \PHP_FLOAT_MAX;
|
||||
|
|
@ -208,12 +208,12 @@ final class Kmeans implements ClusteringInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializae cluster centers
|
||||
* Initialize cluster centers
|
||||
*
|
||||
* @param PointInterface[] $points Points to use for the cluster center initialization
|
||||
* @param int<0, max> $n Amount of clusters to use
|
||||
* @param Point[] $points Points to use for the cluster center initialization
|
||||
* @param int<0, max> $n Amount of clusters to use
|
||||
*
|
||||
* @return PointInterface[]
|
||||
* @return Point[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -61,7 +61,7 @@ final class MeanShift implements ClusteringInterface
|
|||
/**
|
||||
* Points outside of any cluster
|
||||
*
|
||||
* @var PointInterface[]
|
||||
* @var Point[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $noisePoints = [];
|
||||
|
|
@ -79,7 +79,7 @@ final class MeanShift implements ClusteringInterface
|
|||
/**
|
||||
* Points of the cluster centers
|
||||
*
|
||||
* @var PointInterface[]
|
||||
* @var Point[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $clusterCenters = [];
|
||||
|
|
@ -104,7 +104,7 @@ final class MeanShift implements ClusteringInterface
|
|||
*/
|
||||
public function __construct(?\Closure $metric = null, ?\Closure $kernel = null)
|
||||
{
|
||||
$this->metric = $metric ?? function (PointInterface $a, PointInterface $b) {
|
||||
$this->metric = $metric ?? function (Point $a, Point $b) {
|
||||
$aCoordinates = $a->coordinates;
|
||||
$bCoordinates = $b->coordinates;
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ final class MeanShift implements ClusteringInterface
|
|||
/**
|
||||
* Generate the clusters of the points
|
||||
*
|
||||
* @param PointInterface[] $points Points to cluster
|
||||
* @param Point[] $points Points to cluster
|
||||
* @param array<int|float> $bandwidth Bandwidth(s)
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -170,15 +170,15 @@ final class MeanShift implements ClusteringInterface
|
|||
/**
|
||||
* Perform shift on a point
|
||||
*
|
||||
* @param PointInterface $point Point to shift
|
||||
* @param PointInterface $points Array of all points
|
||||
* @param Point $point Point to shift
|
||||
* @param Point $points Array of all points
|
||||
* @param array<int|float> $bandwidth Bandwidth(s)
|
||||
*
|
||||
* @return PointInterface
|
||||
* @return Point
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function shiftPoint(PointInterface $point, array $points, array $bandwidth) : PointInterface
|
||||
private function shiftPoint(Point $point, array $points, array $bandwidth) : Point
|
||||
{
|
||||
$scaleFactor = 0.0;
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ final class MeanShift implements ClusteringInterface
|
|||
/**
|
||||
* Group points together into clusters
|
||||
*
|
||||
* @param PointInterface[] $points Array of points to assign to groups
|
||||
* @param Point[] $points Array of points to assign to groups
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
|
|
@ -242,14 +242,14 @@ final class MeanShift implements ClusteringInterface
|
|||
/**
|
||||
* Find the closest cluster/group of a point
|
||||
*
|
||||
* @param PointInterface $point Point to find the cluster for
|
||||
* @param array<PointInterface[]> $groups Clusters
|
||||
* @param Point $point Point to find the cluster for
|
||||
* @param array<Point[]> $groups Clusters
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function findNearestGroup(PointInterface $point, array $groups) : int
|
||||
private function findNearestGroup(Point $point, array $groups) : int
|
||||
{
|
||||
$nearestGroupIndex = -1;
|
||||
$index = 0;
|
||||
|
|
@ -272,14 +272,14 @@ final class MeanShift implements ClusteringInterface
|
|||
/**
|
||||
* Find distance of point to best cluster/group
|
||||
*
|
||||
* @param PointInterface $point Point to find the cluster for
|
||||
* @param PointInterface[] $group Clusters
|
||||
* @param Point $point Point to find the cluster for
|
||||
* @param Point[] $group Clusters
|
||||
*
|
||||
* @return float Distance
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function distanceToGroup(PointInterface $point, array $group) : float
|
||||
private function distanceToGroup(Point $point, array $group) : float
|
||||
{
|
||||
$minDistance = \PHP_FLOAT_MAX;
|
||||
|
||||
|
|
@ -305,7 +305,7 @@ final class MeanShift implements ClusteringInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cluster(PointInterface $point) : ?PointInterface
|
||||
public function cluster(Point $point) : ?Point
|
||||
{
|
||||
$clusterId = $this->findNearestGroup($point, $this->clusters);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -89,7 +89,7 @@ class Point implements PointInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isEquals(PointInterface $point) : bool
|
||||
public function isEquals(Point $point) : bool
|
||||
{
|
||||
return $this->name === $point->name && $this->coordinates === $point->coordinates;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -25,6 +25,10 @@ namespace phpOMS\Algorithm\Clustering;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @property array<int, int|float> $coordinates
|
||||
* @property string $name
|
||||
* @property int $group
|
||||
*/
|
||||
interface PointInterface
|
||||
{
|
||||
|
|
@ -63,11 +67,11 @@ interface PointInterface
|
|||
/**
|
||||
* Check if two points are equal
|
||||
*
|
||||
* @param self $point Point to compare with
|
||||
* @param Point $point Point to compare with
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function isEquals(self $point) : bool;
|
||||
public function isEquals(Point $point) : bool;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Clustering
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
@ -46,7 +46,7 @@ final class SpectralClustering implements ClusteringInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function cluster(PointInterface $point) : ?PointInterface
|
||||
public function cluster(Point $point) : ?Point
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\CoinMatching
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Frequency
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Graph;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Graph
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\JobScheduling
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\JobScheduling
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\JobScheduling
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling\Dependency
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling\Dependency
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling\Dependency
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling\Dependency
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling\Dependency
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling\Dependency
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling\Dependency
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling\Dependency
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling\Dependency
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Scheduling
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Knapsack
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Knapsack
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Knapsack
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Knapsack
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Knapsack
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Knapsack
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Maze
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Optimization
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Optimization
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Optimization
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Optimization
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Optimization
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Optimization
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Optimization
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Optimization
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\PathFinding
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Rating
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Rating
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Rating
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Rating
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Rating
|
||||
* @copyright Microsoft
|
||||
|
|
@ -28,6 +28,7 @@ use phpOMS\Math\Stochastic\Distribution\NormalDistribution;
|
|||
* @todo Implement https://github.com/sublee/trueskill/blob/master/trueskill/__init__.py
|
||||
* https://github.com/Karaka-Management/phpOMS/issues/337
|
||||
*/
|
||||
// phpcs:ignoreFile
|
||||
class TrueSkill
|
||||
{
|
||||
public const DEFAULT_MU = 25;
|
||||
|
|
@ -226,37 +227,22 @@ class TrueSkill
|
|||
/ (NormalDistribution::getCdf($epsilon - $tAbs, 0.0, 1.0) - NormalDistribution::getCdf(-$epsilon - $tAbs, 0.0, 1.0));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function buildRatingLayer() : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function buildPerformanceLayer() : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function buildTeamPerformanceLayer() : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function buildTruncLayer() : void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function factorGraphBuilders()
|
||||
{
|
||||
// Rating layer
|
||||
|
|
@ -275,9 +261,6 @@ class TrueSkill
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function rating() : void
|
||||
{
|
||||
// Start values
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Rating
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package phpOMS\Algorithm\Sort;
|
||||
* @copyright Dennis Eichhorn
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user