mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-21 20:45:10 +00:00
Update dependencies and fix code styles (#334)
This commit is contained in:
parent
db95db3e57
commit
1934d8af81
508
composer.lock
generated
508
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -157,7 +157,7 @@ class Bagging implements Classifier
|
|||||||
{
|
{
|
||||||
$predictions = [];
|
$predictions = [];
|
||||||
foreach ($this->classifiers as $classifier) {
|
foreach ($this->classifiers as $classifier) {
|
||||||
/* @var $classifier Classifier */
|
/** @var Classifier $classifier */
|
||||||
$predictions[] = $classifier->predict($sample);
|
$predictions[] = $classifier->predict($sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class RandomForest extends Bagging
|
|||||||
// Traverse each tree and sum importance of the columns
|
// Traverse each tree and sum importance of the columns
|
||||||
$sum = [];
|
$sum = [];
|
||||||
foreach ($this->classifiers as $tree) {
|
foreach ($this->classifiers as $tree) {
|
||||||
/* @var $tree DecisionTree */
|
/** @var DecisionTree $tree */
|
||||||
$importances = $tree->getFeatureImportances();
|
$importances = $tree->getFeatureImportances();
|
||||||
|
|
||||||
foreach ($importances as $column => $importance) {
|
foreach ($importances as $column => $importance) {
|
||||||
|
@ -18,7 +18,7 @@ class FuzzyCMeans implements Clusterer
|
|||||||
private $clustersNumber;
|
private $clustersNumber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array|Cluster[]
|
* @var Cluster[]
|
||||||
*/
|
*/
|
||||||
private $clusters = [];
|
private $clusters = [];
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class FuzzyCMeans implements Clusterer
|
|||||||
private $space;
|
private $space;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array|float[][]
|
* @var float[][]
|
||||||
*/
|
*/
|
||||||
private $membership = [];
|
private $membership = [];
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class Space extends SplObjectStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|Cluster[]
|
* @return Cluster[]
|
||||||
*/
|
*/
|
||||||
public function cluster(int $clustersNumber, int $initMethod = KMeans::INIT_RANDOM): array
|
public function cluster(int $clustersNumber, int $initMethod = KMeans::INIT_RANDOM): array
|
||||||
{
|
{
|
||||||
@ -129,7 +129,7 @@ class Space extends SplObjectStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|Cluster[]
|
* @return Cluster[]
|
||||||
*/
|
*/
|
||||||
protected function initializeClusters(int $clustersNumber, int $initMethod): array
|
protected function initializeClusters(int $clustersNumber, int $initMethod): array
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ class StratifiedRandomSplit extends RandomSplit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Dataset[]|array
|
* @return Dataset[]
|
||||||
*/
|
*/
|
||||||
private function splitByTarget(Dataset $dataset): array
|
private function splitByTarget(Dataset $dataset): array
|
||||||
{
|
{
|
||||||
|
@ -17,9 +17,9 @@ final class ANOVA
|
|||||||
* the same population mean. The test is applied to samples from two or
|
* the same population mean. The test is applied to samples from two or
|
||||||
* more groups, possibly with differing sizes.
|
* more groups, possibly with differing sizes.
|
||||||
*
|
*
|
||||||
* @param array|array[] $samples - each row is class samples
|
* @param array[] $samples - each row is class samples
|
||||||
*
|
*
|
||||||
* @return array|float[]
|
* @return float[]
|
||||||
*/
|
*/
|
||||||
public static function oneWayF(array $samples): array
|
public static function oneWayF(array $samples): array
|
||||||
{
|
{
|
||||||
|
@ -9,8 +9,8 @@ use Phpml\Exception\InvalidArgumentException;
|
|||||||
class Correlation
|
class Correlation
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param array|int[]|float[] $x
|
* @param int[]|float[] $x
|
||||||
* @param array|int[]|float[] $y
|
* @param int[]|float[] $y
|
||||||
*
|
*
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
|
@ -9,7 +9,7 @@ use Phpml\Exception\InvalidArgumentException;
|
|||||||
class StandardDeviation
|
class StandardDeviation
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param array|float[]|int[] $numbers
|
* @param float[]|int[] $numbers
|
||||||
*/
|
*/
|
||||||
public static function population(array $numbers, bool $sample = true): float
|
public static function population(array $numbers, bool $sample = true): float
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ class StandardDeviation
|
|||||||
* Sum of squares deviations
|
* Sum of squares deviations
|
||||||
* ∑⟮xᵢ - μ⟯²
|
* ∑⟮xᵢ - μ⟯²
|
||||||
*
|
*
|
||||||
* @param array|float[]|int[] $numbers
|
* @param float[]|int[] $numbers
|
||||||
*/
|
*/
|
||||||
public static function sumOfSquares(array $numbers): float
|
public static function sumOfSquares(array $numbers): float
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@ namespace Phpml;
|
|||||||
class Pipeline implements Estimator
|
class Pipeline implements Estimator
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var array|Transformer[]
|
* @var Transformer[]
|
||||||
*/
|
*/
|
||||||
private $transformers = [];
|
private $transformers = [];
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ class Pipeline implements Estimator
|
|||||||
private $estimator;
|
private $estimator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array|Transformer[] $transformers
|
* @param Transformer[] $transformers
|
||||||
*/
|
*/
|
||||||
public function __construct(array $transformers, Estimator $estimator)
|
public function __construct(array $transformers, Estimator $estimator)
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ class Pipeline implements Estimator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|Transformer[]
|
* @return Transformer[]
|
||||||
*/
|
*/
|
||||||
public function getTransformers(): array
|
public function getTransformers(): array
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user