@@ -59,7 +59,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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,22 +108,22 @@ discard block |
||
| 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++) { |
|
| 126 | - $npoint = array_merge($npoint,$transformer[$j]($this->data[$i][$j])); |
|
| 125 | + for ($j = 0; $j < $ndim; $j++) { |
|
| 126 | + $npoint = array_merge($npoint, $transformer[$j]($this->data[$i][$j])); |
|
| 127 | 127 | } |
| 128 | 128 | $ndata[] = $npoint; |
| 129 | 129 | } |