Passed
Push — master ( a95697...1236a7 )
by Iván
02:34
created
src/MachineLearning/Domain/Model/Value/VectorValue.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     }
19 19
 
20 20
     /**
21
-     * @return \float[]
21
+     * @return double[]
22 22
      */
23 23
     public function getValue()
24 24
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@
 block discarded – undo
31 31
     public function scalar(ValueInterface $value)
32 32
     {
33 33
         $result = 0;
34
-        for ($i=0; $i<count($this->value); $i++) {
35
-            $result += $this->value[$i]*$value->getValue()[$i];
34
+        for ($i = 0; $i < count($this->value); $i++) {
35
+            $result += $this->value[$i] * $value->getValue()[$i];
36 36
         }
37 37
         return $result;
38 38
     }
Please login to merge, or discard this patch.
src/MachineLearning/Application/Algorithm/GradientDescendent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
         $coefficientVector[0] = 0;
72 72
         $incrementVector = array_fill(0, $features+1, 0);
73 73
 
74
-        while(!$convergence && !$divergence) {
74
+        while (!$convergence && !$divergence) {
75 75
             $coefficient = new VectorValue($coefficientVector);
76 76
 
77 77
             $costVector = array_fill(0, $features+1, 0);
Please login to merge, or discard this patch.
src/MachineLearning/Application/Normalization/MeanScaleNormalization.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
         //@todo we could validate if value and coefficient have same same dimension
27 27
         //should be done in a upper layer, in order not to execute it every row
28 28
 
29
-        for ($i=0; $i<count($rawValue); $i++) {
29
+        for ($i = 0; $i < count($rawValue); $i++) {
30 30
             $rawValue[$i] =
31 31
                 (
32
-                    $rawValue[$i] - $rawCoefficient[static::COEFFICIENT_AVERAGE][$i]
32
+                    $rawValue[$i]-$rawCoefficient[static::COEFFICIENT_AVERAGE][$i]
33 33
                 )
34 34
                 / $rawCoefficient[static::COEFFICIENT_RANGE][$i]
35 35
             ;
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 
68 68
         foreach ($featuresAverage as $i => $featureAverage) {
69 69
             $featuresAverage[$i] = $featureAverage / count($data);
70
-            $featuresRange[$i] = ($featuresMaximumValue[$i] - $featuresMinimumValue[$i]) > 0 ?
71
-                ($featuresMaximumValue[$i] - $featuresMinimumValue[$i])
70
+            $featuresRange[$i] = ($featuresMaximumValue[$i]-$featuresMinimumValue[$i]) > 0 ?
71
+                ($featuresMaximumValue[$i]-$featuresMinimumValue[$i])
72 72
                 : 1;
73 73
         }
74 74
 
Please login to merge, or discard this patch.
src/MachineLearning/Domain/Model/Value/ScalarValue.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      */
31 31
     public function scalar(ValueInterface $value)
32 32
     {
33
-        return $value->getValue()*$this->getValue();
33
+        return $value->getValue() * $this->getValue();
34 34
     }
35 35
 
36 36
 
Please login to merge, or discard this patch.
src/MachineLearning/Domain/Hypothesis/Linear.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function calculate(ValueInterface $coefficient, ValueInterface $variable)
17 17
     {
18
-        if (! $variable instanceof VectorValue) {
18
+        if (!$variable instanceof VectorValue) {
19 19
             throw new WrongVariableForHypothesisException();
20 20
         }
21 21
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function derivative(ValueInterface $coefficient, ValueInterface $variable, $partialVariable)
32 32
     {
33
-        if (! $variable instanceof VectorValue) {
33
+        if (!$variable instanceof VectorValue) {
34 34
             throw new WrongVariableForHypothesisException();
35 35
         }
36 36
 
Please login to merge, or discard this patch.