Passed
Push — master ( c02f08...0839b6 )
by Ruben
02:19
created
src/CategoricalDataset.php 1 patch
Spacing   +12 added lines, -12 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[$col] = $vals;
65 65
             $this->featIndexMap[$col] = count($vals);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $tmp = Matrix::getColumn($this->data, $col);
82 82
         $n = count($tmp);
83 83
         $resp = [];
84
-        for ($i=0; $i<$n; $i++) {
84
+        for ($i = 0; $i < $n; $i++) {
85 85
             if (!in_array($tmp[$i], $resp)) {
86 86
                 $resp[] = $tmp[$i];
87 87
             }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         $size = count($array);
99 99
         $resp = [];
100
-        for ($i=0;$i<$size;$i++) {
100
+        for ($i = 0; $i < $size; $i++) {
101 101
             $tmp = array_fill(0, $size, 0);
102 102
             $tmp[$i] = 1;  
103 103
             $resp[$array[$i]] = $tmp;
@@ -108,21 +108,21 @@  discard block
 block discarded – undo
108 108
     /*
109 109
      * @param
110 110
      */  
111
-    public function encode(){
112
-        $transformer  = [];
111
+    public function encode() {
112
+        $transformer = [];
113 113
         $n = count($this->data);
114 114
         $ndim = count($this->data[0]);
115
-        for ($j=0; $j<$ndim; $j++) {
116
-            $transformer[] = function($val){ return [$val]; };
115
+        for ($j = 0; $j < $ndim; $j++) {
116
+            $transformer[] = function($val) { return [$val]; };
117 117
         }
118
-        foreach($this->sortedEncodedFeatures as $col) {
119
-            $transformer[$col] = function ($val) use ($col) { return $this->featEncode[$col][$val]; };
118
+        foreach ($this->sortedEncodedFeatures as $col) {
119
+            $transformer[$col] = function($val) use ($col) { return $this->featEncode[$col][$val]; };
120 120
         }
121 121
         
122 122
         $ndata = [];
123
-        for ($i=0; $i<$n; $i++) {
123
+        for ($i = 0; $i < $n; $i++) {
124 124
             $npoint = [];
125
-            for ($j=0; $j<$ndim; $j++) {
125
+            for ($j = 0; $j < $ndim; $j++) {
126 126
                 $npoint = array_merge($npoint, $transformer[$j]($this->data[$i][$j]));
127 127
             }            
128 128
             $ndata[] = $npoint;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     {
138 138
         $resp = [];
139 139
         $len = count($data[0]);
140
-        for ($i=0; $i<$len; $i++) {
140
+        for ($i = 0; $i < $len; $i++) {
141 141
             if (isset($this->encodedValues[$i])) {
142 142
                 $resp = array_merge($resp, $this->encodedValues[$i]);
143 143
             } else {
Please login to merge, or discard this patch.