@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->encodedValues = []; |
| 36 | 36 | $this->sortedEncodedFeatures = $array; |
| 37 | 37 | $this->newEncodedSize = count($array); |
| 38 | - foreach($this->sortedEncodedFeatures as $col){ |
|
| 38 | + foreach ($this->sortedEncodedFeatures as $col) { |
|
| 39 | 39 | $vals = $this->getUniqueValues($col); |
| 40 | 40 | $this->encodedValues[] = $vals; |
| 41 | 41 | $this->featIndexMap[$col] = count($vals); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | function encodeFeature($size) |
| 68 | 68 | { |
| 69 | 69 | $resp = []; |
| 70 | - for ($i=0;$i<$size;$i++) { |
|
| 70 | + for ($i = 0; $i < $size; $i++) { |
|
| 71 | 71 | $tmp = array_fill(0, $size, 0); |
| 72 | 72 | $tmp[$i] = 1; |
| 73 | 73 | $resp[] = $tmp; |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | /* |
| 79 | 79 | * @param |
| 80 | 80 | */ |
| 81 | - function encode(){ |
|
| 82 | - $transformer = []; |
|
| 81 | + function encode() { |
|
| 82 | + $transformer = []; |
|
| 83 | 83 | $ndata = []; |
| 84 | - for ($j=0; $j<$ndim; $j++) { |
|
| 85 | - $transformer[] = function($val){ return [$val]; }; |
|
| 84 | + for ($j = 0; $j < $ndim; $j++) { |
|
| 85 | + $transformer[] = function($val) { return [$val]; }; |
|
| 86 | 86 | } |
| 87 | - foreach($this->sortedEncodedFeatures as $col) { |
|
| 87 | + foreach ($this->sortedEncodedFeatures as $col) { |
|
| 88 | 88 | $transformer[$col] = function($val) { return $this->featEncode[$col][$val]; }; |
| 89 | 89 | } |
| 90 | 90 | $ndata = []; |
| 91 | - for ($i=0; $i<$npoints; $i++) { |
|
| 91 | + for ($i = 0; $i < $npoints; $i++) { |
|
| 92 | 92 | $npoint = []; |
| 93 | - for ($j=0; $j<$ndim; $j++) { |
|
| 93 | + for ($j = 0; $j < $ndim; $j++) { |
|
| 94 | 94 | $npoint += $transformer[$j]($data[$i][$j]); |
| 95 | 95 | } |
| 96 | 96 | $ndata[] = $npoint; |