@@ -18,7 +18,7 @@ |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
21 | - * @return \float[] |
|
21 | + * @return double[] |
|
22 | 22 | */ |
23 | 23 | public function getValue() |
24 | 24 | { |
@@ -31,8 +31,8 @@ |
||
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 | } |
@@ -71,7 +71,7 @@ |
||
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); |
@@ -26,10 +26,10 @@ discard block |
||
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 |
||
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 |
@@ -30,7 +30,7 @@ |
||
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 |
@@ -15,7 +15,7 @@ discard block |
||
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 |
||
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 |