@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | sort($array); |
61 | 61 | $this->encodedValues = []; |
62 | 62 | $this->sortedEncodedFeatures = $array; |
63 | - foreach($this->sortedEncodedFeatures as $col){ |
|
63 | + foreach ($this->sortedEncodedFeatures as $col) { |
|
64 | 64 | $vals = $this->getUniqueValues($col); |
65 | 65 | $this->encodedValues[] = $vals; |
66 | 66 | $this->featIndexMap[$col] = count($vals); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | private function encodeFeature($size) |
93 | 93 | { |
94 | 94 | $resp = []; |
95 | - for ($i=0;$i<$size;$i++) { |
|
95 | + for ($i = 0; $i < $size; $i++) { |
|
96 | 96 | $tmp = array_fill(0, $size, 0); |
97 | 97 | $tmp[$i] = 1; |
98 | 98 | $resp[] = $tmp; |
@@ -103,20 +103,20 @@ discard block |
||
103 | 103 | /* |
104 | 104 | * @param |
105 | 105 | */ |
106 | - public function encode(){ |
|
107 | - $transformer = []; |
|
106 | + public function encode() { |
|
107 | + $transformer = []; |
|
108 | 108 | $n = count($this->data); |
109 | 109 | $ndim = count($this->data[0]); |
110 | - for ($j=0; $j<$ndim; $j++) { |
|
111 | - $transformer[] = function($val){ return [$val]; }; |
|
110 | + for ($j = 0; $j < $ndim; $j++) { |
|
111 | + $transformer[] = function($val) { return [$val]; }; |
|
112 | 112 | } |
113 | - foreach($this->sortedEncodedFeatures as $col) { |
|
113 | + foreach ($this->sortedEncodedFeatures as $col) { |
|
114 | 114 | $transformer[$col] = function($val) { return $this->featEncode[$col][$val]; }; |
115 | 115 | } |
116 | 116 | $ndata = []; |
117 | - for ($i=0; $i<$n; $i++) { |
|
117 | + for ($i = 0; $i < $n; $i++) { |
|
118 | 118 | $npoint = []; |
119 | - for ($j=0; $j<$ndim; $j++) { |
|
119 | + for ($j = 0; $j < $ndim; $j++) { |
|
120 | 120 | $npoint += $transformer[$j]($data[$i][$j]); |
121 | 121 | } |
122 | 122 | $ndata[] = $npoint; |