Passed
Push — master ( 6f5dde...cd5ba0 )
by Ruben
01:59
created
src/CategoricalDataset.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         sort($array);
60 60
         $this->encodedValues = [];
61 61
         $this->sortedEncodedFeatures = $array;
62
-        foreach($this->sortedEncodedFeatures as $col){
62
+        foreach ($this->sortedEncodedFeatures as $col) {
63 63
             $vals = $this->getUniqueValues($col);
64 64
             $this->encodedValues[] = $vals;
65 65
             $this->featIndexMap[$col] = count($vals);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     private function encodeFeature($size) 
90 90
     {
91 91
         $resp = [];
92
-        for ($i=0;$i<$size;$i++) {
92
+        for ($i = 0; $i < $size; $i++) {
93 93
             $tmp = array_fill(0, $size, 0);
94 94
             $tmp[$i] = 1;  
95 95
             $resp[] = $tmp;
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
     /*
101 101
      * @param
102 102
      */  
103
-    public function encode(){
104
-        $transformer  = [];
103
+    public function encode() {
104
+        $transformer = [];
105 105
         $n = count($this->data);
106 106
         $ndim = count($this->data[0]);
107
-        for ($j=0; $j<$ndim; $j++) {
108
-            $transformer[] = function($val){ return [$val]; };
107
+        for ($j = 0; $j < $ndim; $j++) {
108
+            $transformer[] = function($val) { return [$val]; };
109 109
         }
110
-        foreach($this->sortedEncodedFeatures as $col) {
111
-            $transformer[$col] = function ($val) use ($col) { return $this->featEncode[$col][$val]; };
110
+        foreach ($this->sortedEncodedFeatures as $col) {
111
+            $transformer[$col] = function($val) use ($col) { return $this->featEncode[$col][$val]; };
112 112
         }
113 113
         $ndata = [];
114
-        for ($i=0; $i<$n; $i++) {
114
+        for ($i = 0; $i < $n; $i++) {
115 115
             $npoint = [];
116
-            for ($j=0; $j<$ndim; $j++) {
116
+            for ($j = 0; $j < $ndim; $j++) {
117 117
                 $npoint += $transformer[$j]($this->data[$i][$j]);
118 118
             }
119 119
             $ndata[] = $npoint;
Please login to merge, or discard this patch.