mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-10 17:28:40 +00:00
fix tests
This commit is contained in:
parent
5230892673
commit
126fca5574
|
|
@ -104,7 +104,7 @@ final class AffinityPropagation implements ClusteringInterface
|
|||
* Generate clusters for points
|
||||
*
|
||||
* @param Point[] $points Points to cluster
|
||||
* @param int $iterations Iterations for cluster generation
|
||||
* @param int $iterations Iterations for cluster generation
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -188,8 +188,8 @@ final class AffinityPropagation implements ClusteringInterface
|
|||
/**
|
||||
* 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
|
||||
* @param array<int, Point> $similarityMatrix Similarity matrix
|
||||
* @param int $point Point id in the similarity matrix to compare
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -130,10 +130,10 @@ final class DBSCAN implements ClusteringInterface
|
|||
* Expand cluster with additional point and potential neighbors.
|
||||
*
|
||||
* @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
|
||||
* @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
|
||||
*
|
||||
|
|
@ -175,7 +175,7 @@ final class DBSCAN implements ClusteringInterface
|
|||
* Find neighbors of a point
|
||||
*
|
||||
* @param Point $point Base point for potential neighbors
|
||||
* @param float $epsilon Max distance to neighbor
|
||||
* @param float $epsilon Max distance to neighbor
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
|
|
@ -252,8 +252,8 @@ final class DBSCAN implements ClusteringInterface
|
|||
* Generate the clusters of the points
|
||||
*
|
||||
* @param Point[] $points Points to cluster
|
||||
* @param float $epsilon Max distance
|
||||
* @param int $minPoints Min amount of points required for a cluster
|
||||
* @param float $epsilon Max distance
|
||||
* @param int $minPoints Min amount of points required for a cluster
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
|
|||
|
|
@ -121,8 +121,8 @@ final class Kmeans implements ClusteringInterface
|
|||
/**
|
||||
* Generate the clusters of the points
|
||||
*
|
||||
* @param Point[] $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
|
||||
*
|
||||
|
|
@ -210,8 +210,8 @@ final class Kmeans implements ClusteringInterface
|
|||
/**
|
||||
* Initialize cluster centers
|
||||
*
|
||||
* @param Point[] $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 Point[]
|
||||
*
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ final class MeanShift implements ClusteringInterface
|
|||
/**
|
||||
* Generate the clusters of the points
|
||||
*
|
||||
* @param Point[] $points Points to cluster
|
||||
* @param Point[] $points Points to cluster
|
||||
* @param array<int|float> $bandwidth Bandwidth(s)
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -170,8 +170,8 @@ final class MeanShift implements ClusteringInterface
|
|||
/**
|
||||
* Perform shift on a point
|
||||
*
|
||||
* @param Point $point Point to shift
|
||||
* @param Point $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 Point
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ final class Loan
|
|||
*
|
||||
* @param float $loan Loan amount
|
||||
* @param float $r Rate
|
||||
* @param float $duration Loan duration
|
||||
* @param float $interval Payment interval
|
||||
* @param int $duration Loan duration
|
||||
* @param int $interval Payment interval
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
|
|
@ -156,7 +156,7 @@ final class Loan
|
|||
*
|
||||
* @param float $loan Loan amount
|
||||
* @param float $r Rate
|
||||
* @param float $interval Payment interval
|
||||
* @param int $interval Payment interval
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
|
|
@ -171,7 +171,7 @@ final class Loan
|
|||
* Calculate the principal for amortization loans
|
||||
*
|
||||
* @param float $payment Total payment
|
||||
* @param float $interval Payment interval
|
||||
* @param float $interest Interest payment
|
||||
*
|
||||
* @return float
|
||||
*
|
||||
|
|
@ -183,6 +183,8 @@ final class Loan
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculate schedule for amortization loan
|
||||
*
|
||||
* @param float $loan Loan amount
|
||||
* @param float $r Borrowing rate (annual)
|
||||
* @param int $duration Loan duration in months
|
||||
|
|
|
|||
|
|
@ -217,6 +217,9 @@ abstract class CodeAbstract
|
|||
public function saveToPngFile(string $file) : void
|
||||
{
|
||||
$res = $this->get();
|
||||
if ($res === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
\imagepng($res, $file);
|
||||
\imagedestroy($res);
|
||||
|
|
@ -234,6 +237,9 @@ abstract class CodeAbstract
|
|||
public function saveToJpgFile(string $file) : void
|
||||
{
|
||||
$res = $this->get();
|
||||
if ($res === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
\imagejpeg($res, $file);
|
||||
\imagedestroy($res);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user