@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | /* |
| 29 | 29 | * @param |
| 30 | 30 | */ |
| 31 | - function setEncodedFeatures($array){ |
|
| 31 | + function setEncodedFeatures($array) { |
|
| 32 | 32 | $array = sort($array); |
| 33 | 33 | $this->encodedValues = []; |
| 34 | 34 | $this->sortedEncodedFeatures = $array; |
| 35 | - foreach($this->sortedEncodedFeatures as $col){ |
|
| 35 | + foreach ($this->sortedEncodedFeatures as $col) { |
|
| 36 | 36 | $vals = $this->getUniqueValues($col); |
| 37 | 37 | $this->encodedValues[] = $vals; |
| 38 | 38 | $this->encodedFeatMapSize[$col] = count($vals); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /* |
| 43 | 43 | * @param |
| 44 | 44 | */ |
| 45 | - function getUniqueValues($col){ |
|
| 45 | + function getUniqueValues($col) { |
|
| 46 | 46 | $resp = []; |
| 47 | 47 | $resp = Matrix::getColumn($data, $col); |
| 48 | 48 | $resp = array_unique($resp); |
@@ -52,19 +52,19 @@ discard block |
||
| 52 | 52 | /* |
| 53 | 53 | * @param |
| 54 | 54 | */ |
| 55 | - function encode(){ |
|
| 56 | - $transformer = []; |
|
| 55 | + function encode() { |
|
| 56 | + $transformer = []; |
|
| 57 | 57 | $ndata = []; |
| 58 | - for ($j=0; $j<$ndim; $j++) { |
|
| 59 | - $transformer[] = function($val){ return $val; }; |
|
| 58 | + for ($j = 0; $j < $ndim; $j++) { |
|
| 59 | + $transformer[] = function($val) { return $val; }; |
|
| 60 | 60 | } |
| 61 | - foreach( as $key => $val) { |
|
| 61 | + foreach (as $key => $val) { |
|
| 62 | 62 | $transformer[$key] = function($val) { return $this->featEncode[$key][$val]; }; |
| 63 | 63 | } |
| 64 | 64 | $ndata = []; |
| 65 | - for ($i=0; $i<$npoints; $i++) { |
|
| 65 | + for ($i = 0; $i < $npoints; $i++) { |
|
| 66 | 66 | $npoint = []; |
| 67 | - for ($j=0; $j<$ndim; $j++) { |
|
| 67 | + for ($j = 0; $j < $ndim; $j++) { |
|
| 68 | 68 | $npoint[] = $transformer[$j]($data[$i][$j]); |
| 69 | 69 | } |
| 70 | 70 | $ndata[] = $npoint; |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | /* |
| 76 | 76 | * @param |
| 77 | 77 | */ |
| 78 | - function decode($ndata){ |
|
| 78 | + function decode($ndata) { |
|
| 79 | 79 | $resp = []; |
| 80 | - for ($i=0; $i<$npoints; $i++) { |
|
| 80 | + for ($i = 0; $i < $npoints; $i++) { |
|
| 81 | 81 | //$point = array_fill(0, $nexpdim; null); |
| 82 | 82 | $point = array($ndata[$i]); |
| 83 | - foreach ( as $key => $val) { |
|
| 83 | + foreach (as $key => $val) { |
|
| 84 | 84 | $this->featDecode[$key]($point); |
| 85 | 85 | } |
| 86 | 86 | $point = $this->removeNulls($point); |