Completed
Pull Request — master (#85)
by Marcin
04:46
created
src/Phpml/NeuralNetwork/ActivationFunction/Gaussian.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\NeuralNetwork\ActivationFunction;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/NeuralNetwork/Network/LayeredNetwork.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\NeuralNetwork\Network;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/CrossValidation/Split.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\CrossValidation;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/Tokenization/WordTokenizer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\Tokenization;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/Classification/Classifier.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\Classification;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/SupportVectorMachine/SupportVectorMachine.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\SupportVectorMachine;
6 6
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@
 block discarded – undo
10 10
 {
11 11
     use Trainable;
12 12
      
13
-     /**
14
-     * @var int
15
-     */
13
+        /**
14
+         * @var int
15
+         */
16 16
     private $type;
17 17
 
18 18
     /**
Please login to merge, or discard this patch.
src/Phpml/Clustering/KMeans/Space.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     protected $dimension;
18 18
 
19 19
     /**
20
-     * @param $dimension
20
+     * @param integer $dimension
21 21
      */
22 22
     public function __construct($dimension)
23 23
     {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     /**
226 226
      * @param int $clustersNumber
227 227
      *
228
-     * @return array
228
+     * @return Cluster[]
229 229
      */
230 230
     protected function initializeKMPPClusters(int $clustersNumber)
231 231
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml\Clustering\KMeans;
6 6
 
Please login to merge, or discard this patch.
src/Phpml/Clustering/FuzzyCMeans.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Phpml\Clustering;
5 5
 
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
     protected function generateRandomMembership(int $rows, int $cols)
86 86
     {
87 87
         $this->membership = [];
88
-        for ($i=0; $i < $rows; $i++) {
88
+        for ($i = 0; $i < $rows; $i++) {
89 89
             $row = [];
90 90
             $total = 0.0;
91
-            for ($k=0; $k < $cols; $k++) {
91
+            for ($k = 0; $k < $cols; $k++) {
92 92
                 $val = rand(1, 5) / 10.0;
93 93
                 $row[] = $val;
94 94
                 $total += $val;
95 95
             }
96
-            $this->membership[] = array_map(function ($val) use ($total) {
96
+            $this->membership[] = array_map(function($val) use ($total) {
97 97
                 return $val / $total;
98 98
             }, $row);
99 99
         }
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
     protected function updateClusters()
103 103
     {
104 104
         $dim = $this->space->getDimension();
105
-        if (! $this->clusters) {
105
+        if (!$this->clusters) {
106 106
             $this->clusters = [];
107
-            for ($i=0; $i<$this->clustersNumber; $i++) {
107
+            for ($i = 0; $i < $this->clustersNumber; $i++) {
108 108
                 $this->clusters[] = new Cluster($this->space, array_fill(0, $dim, 0.0));
109 109
             }
110 110
         }
111 111
 
112
-        for ($i=0; $i<$this->clustersNumber; $i++) {
112
+        for ($i = 0; $i < $this->clustersNumber; $i++) {
113 113
             $cluster = $this->clusters[$i];
114 114
             $center = $cluster->getCoordinates();
115
-            for ($k=0; $k<$dim; $k++) {
115
+            for ($k = 0; $k < $dim; $k++) {
116 116
                 $a = $this->getMembershipRowTotal($i, $k, true);
117 117
                 $b = $this->getMembershipRowTotal($i, $k, false);
118 118
                 $center[$k] = $a / $b;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     {
203 203
         // Initialize variables, clusters and membership matrix
204 204
         $this->sampleCount = count($samples);
205
-        $this->samples =& $samples;
205
+        $this->samples = & $samples;
206 206
         $this->space = new Space(count($samples[0]));
207 207
         $this->initClusters();
208 208
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         } while ($difference > $this->epsilon && $iterations++ <= $this->maxIterations);
224 224
 
225 225
         // Attach (hard cluster) each data point to the nearest cluster
226
-        for ($k=0; $k<$this->sampleCount; $k++) {
226
+        for ($k = 0; $k < $this->sampleCount; $k++) {
227 227
             $column = array_column($this->membership, $k);
228 228
             arsort($column);
229 229
             reset($column);
Please login to merge, or discard this patch.
src/Phpml/Transformer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Phpml;
6 6
 
Please login to merge, or discard this patch.