Skip to content

Commit

Permalink
[cs] remove more unused comments (#146)
Browse files Browse the repository at this point in the history
* [cs] remove more unused comments

* [cs] remove unused array phpdocs

* [cs] remove empty lines in docs

* [cs] space-proof useless docs

* [cs] remove empty @param lines

* [cs] remove references arrays
  • Loading branch information
Tomáš Votruba authored and akondas committed Nov 13, 2017
1 parent f4650c6 commit d85bfed
Show file tree
Hide file tree
Showing 32 changed files with 0 additions and 193 deletions.
23 changes: 0 additions & 23 deletions src/Phpml/Classification/DecisionTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ public function __construct(int $maxDepth = 10)
$this->maxDepth = $maxDepth;
}

/**
* @param array $samples
* @param array $targets
*/
public function train(array $samples, array $targets)
{
$this->samples = array_merge($this->samples, $samples);
Expand Down Expand Up @@ -104,11 +100,6 @@ public function train(array $samples, array $targets)
}
}

/**
* @param array $samples
*
* @return array
*/
public static function getColumnTypes(array $samples) : array
{
$types = [];
Expand All @@ -122,10 +113,6 @@ public static function getColumnTypes(array $samples) : array
return $types;
}

/**
* @param array $records
* @param int $depth
*/
protected function getSplitLeaf(array $records, int $depth = 0) : DecisionTreeLeaf
{
$split = $this->getBestSplit($records);
Expand Down Expand Up @@ -239,8 +226,6 @@ protected function getBestSplit(array $records) : DecisionTreeLeaf
*
* If any of above methods were not called beforehand, then all features
* are returned by default.
*
* @return array
*/
protected function getSelectedFeatures() : array
{
Expand Down Expand Up @@ -296,11 +281,6 @@ public function getGiniIndex($baseValue, array $colValues, array $targets) : flo
return array_sum($giniParts) / count($colValues);
}

/**
* @param array $samples
*
* @return array
*/
protected function preprocess(array $samples) : array
{
// Detect and convert continuous data column values into
Expand All @@ -325,9 +305,6 @@ protected function preprocess(array $samples) : array
return array_map(null, ...$columns);
}

/**
* @param array $columnValues
*/
protected static function isCategoricalColumn(array $columnValues) : bool
{
$count = count($columnValues);
Expand Down
1 change: 0 additions & 1 deletion src/Phpml/Classification/Linear/Adaline.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public function __construct(
/**
* Adapts the weights with respect to given samples and targets
* by use of gradient descent learning rule
* @param array $targets
*/
protected function runTraining(array $samples, array $targets)
{
Expand Down
3 changes: 0 additions & 3 deletions src/Phpml/Classification/Linear/LogisticRegression.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ protected function runTraining(array $samples, array $targets)

/**
* Executes Conjugate Gradient method to optimize the weights of the LogReg model
*
* @param array $samples
* @param array $targets
*/
protected function runConjugateGradient(array $samples, array $targets, \Closure $gradientFunc)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Phpml/Classification/WeightedClassifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ abstract class WeightedClassifier implements Classifier

/**
* Sets the array including a weight for each sample
*
* @param array $weights
*/
public function setSampleWeights(array $weights)
{
Expand Down
9 changes: 0 additions & 9 deletions src/Phpml/Dataset/ArrayDataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ class ArrayDataset implements Dataset
protected $targets = [];

/**
* @param array $samples
* @param array $targets
*
* @throws InvalidArgumentException
*/
public function __construct(array $samples, array $targets)
Expand All @@ -34,17 +31,11 @@ public function __construct(array $samples, array $targets)
$this->targets = $targets;
}

/**
* @return array
*/
public function getSamples() : array
{
return $this->samples;
}

/**
* @return array
*/
public function getTargets() : array
{
return $this->targets;
Expand Down
6 changes: 0 additions & 6 deletions src/Phpml/DimensionReduction/EigenTransformerBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ abstract class EigenTransformerBase
* Calculates eigenValues and eigenVectors of the given matrix. Returns
* top eigenVectors along with the largest eigenValues. The total explained variance
* of these eigenVectors will be no less than desired $totalVariance value
*
* @param array $matrix
*/
protected function eigenDecomposition(array $matrix)
{
Expand Down Expand Up @@ -85,10 +83,6 @@ protected function eigenDecomposition(array $matrix)

/**
* Returns the reduced data
*
* @param array $data
*
* @return array
*/
protected function reduce(array $data) : array
{
Expand Down
12 changes: 0 additions & 12 deletions src/Phpml/FeatureExtraction/TfIdfTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,13 @@ class TfIdfTransformer implements Transformer
*/
private $idf;

/**
* @param array $samples
*/
public function __construct(array $samples = null)
{
if ($samples) {
$this->fit($samples);
}
}

/**
* @param array $samples
*/
public function fit(array $samples)
{
$this->countTokensFrequency($samples);
Expand All @@ -36,9 +30,6 @@ public function fit(array $samples)
}
}

/**
* @param array $samples
*/
public function transform(array &$samples)
{
foreach ($samples as &$sample) {
Expand All @@ -48,9 +39,6 @@ public function transform(array &$samples)
}
}

/**
* @param array $samples
*/
private function countTokensFrequency(array $samples)
{
$this->idf = array_fill_keys(array_keys($samples[0]), 0);
Expand Down
6 changes: 0 additions & 6 deletions src/Phpml/Helper/Optimizer/ConjugateGradient.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
*/
class ConjugateGradient extends GD
{
/**
* @param array $samples
* @param array $targets
*
* @return array
*/
public function runOptimization(array $samples, array $targets, \Closure $gradientCb) : array
{
$this->samples = $samples;
Expand Down
3 changes: 0 additions & 3 deletions src/Phpml/Math/LinearAlgebra/EigenvalueDecomposition.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare(strict_types=1);
/**
*
* Class to obtain eigenvalues and eigenvectors of a real matrix.
*
* If A is symmetric, then A = V*D*V' where the eigenvalue matrix D
Expand Down Expand Up @@ -88,8 +87,6 @@ class EigenvalueDecomposition

/**
* Constructor: Check for symmetry, then construct the eigenvalue decomposition
*
* @param array $Arg
*/
public function __construct(array $Arg)
{
Expand Down
3 changes: 0 additions & 3 deletions src/Phpml/Math/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
class Product
{
/**
* @param array $a
* @param array $b
*
* @return mixed
*/
public static function scalar(array $a, array $b)
Expand Down
8 changes: 0 additions & 8 deletions src/Phpml/Math/Statistic/Mean.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
class Mean
{
/**
* @param array $numbers
*
* @throws InvalidArgumentException
*/
public static function arithmetic(array $numbers) : float
Expand All @@ -21,8 +19,6 @@ public static function arithmetic(array $numbers) : float
}

/**
* @param array $numbers
*
* @return float|mixed
*
* @throws InvalidArgumentException
Expand All @@ -44,8 +40,6 @@ public static function median(array $numbers)
}

/**
* @param array $numbers
*
* @return mixed
*
* @throws InvalidArgumentException
Expand All @@ -60,8 +54,6 @@ public static function mode(array $numbers)
}

/**
* @param array $array
*
* @throws InvalidArgumentException
*/
private static function checkArrayLength(array $array)
Expand Down
4 changes: 0 additions & 4 deletions src/Phpml/Metric/Accuracy.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
class Accuracy
{
/**
* @param array $actualLabels
* @param array $predictedLabels
* @param bool $normalize
*
* @return float|int
*
* @throws InvalidArgumentException
Expand Down
6 changes: 0 additions & 6 deletions src/Phpml/Metric/ClassificationReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,6 @@ private function computeF1Score(float $precision, float $recall) : float
return 2.0 * (($precision * $recall) / $divider);
}

/**
* @param array $actualLabels
* @param array $predictedLabels
*
* @return array
*/
private static function getLabelIndexedArray(array $actualLabels, array $predictedLabels) : array
{
$labels = array_values(array_unique(array_merge($actualLabels, $predictedLabels)));
Expand Down
17 changes: 0 additions & 17 deletions src/Phpml/Metric/ConfusionMatrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

class ConfusionMatrix
{
/**
* @param array $actualLabels
* @param array $predictedLabels
* @param array $labels
*
* @return array
*/
public static function compute(array $actualLabels, array $predictedLabels, array $labels = null) : array
{
$labels = $labels ? array_flip($labels) : self::getUniqueLabels($actualLabels);
Expand All @@ -38,11 +31,6 @@ public static function compute(array $actualLabels, array $predictedLabels, arra
return $matrix;
}

/**
* @param array $labels
*
* @return array
*/
private static function generateMatrixWithZeros(array $labels) : array
{
$count = count($labels);
Expand All @@ -55,11 +43,6 @@ private static function generateMatrixWithZeros(array $labels) : array
return $matrix;
}

/**
* @param array $labels
*
* @return array
*/
private static function getUniqueLabels(array $labels) : array
{
$labels = array_values(array_unique($labels));
Expand Down
3 changes: 0 additions & 3 deletions src/Phpml/NeuralNetwork/Network/LayeredNetwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ public function getOutputLayer(): Layer
return $this->layers[count($this->layers) - 1];
}

/**
* @return array
*/
public function getOutput() : array
{
$result = [];
Expand Down
1 change: 0 additions & 1 deletion src/Phpml/NeuralNetwork/Node/Neuron/Synapse.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Synapse
protected $node;

/**
* @param Node $node
* @param float|null $weight
*/
public function __construct(Node $node, float $weight = null)
Expand Down
10 changes: 0 additions & 10 deletions src/Phpml/Pipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Pipeline implements Estimator

/**
* @param array|Transformer[] $transformers
* @param Estimator $estimator
*/
public function __construct(array $transformers, Estimator $estimator)
{
Expand Down Expand Up @@ -52,10 +51,6 @@ public function getEstimator(): Estimator
return $this->estimator;
}

/**
* @param array $samples
* @param array $targets
*/
public function train(array $samples, array $targets)
{
foreach ($this->transformers as $transformer) {
Expand All @@ -67,8 +62,6 @@ public function train(array $samples, array $targets)
}

/**
* @param array $samples
*
* @return mixed
*/
public function predict(array $samples)
Expand All @@ -78,9 +71,6 @@ public function predict(array $samples)
return $this->estimator->predict($samples);
}

/**
* @param array $samples
*/
private function transformSamples(array &$samples)
{
foreach ($this->transformers as $transformer) {
Expand Down
Loading

0 comments on commit d85bfed

Please sign in to comment.