@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $array = sort($array); |
35 | 35 | $this->encodedValues = []; |
36 | 36 | $this->sortedEncodedFeatures = $array; |
37 | - foreach($this->sortedEncodedFeatures as $col){ |
|
37 | + foreach ($this->sortedEncodedFeatures as $col) { |
|
38 | 38 | $vals = $this->getUniqueValues($col); |
39 | 39 | $this->encodedValues[] = $vals; |
40 | 40 | $this->encodedFeatMapSize[$col] = count($vals); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | function encodeFeature($size) |
61 | 61 | { |
62 | 62 | $resp = []; |
63 | - for ($i=0;$i<$size;$i++) { |
|
63 | + for ($i = 0; $i < $size; $i++) { |
|
64 | 64 | $tmp = array_fill(0, $size, 0); |
65 | 65 | $tmp[$i] = 1; |
66 | 66 | $resp[] = $tmp; |
@@ -71,19 +71,19 @@ discard block |
||
71 | 71 | /* |
72 | 72 | * @param |
73 | 73 | */ |
74 | - function encode(){ |
|
75 | - $transformer = []; |
|
74 | + function encode() { |
|
75 | + $transformer = []; |
|
76 | 76 | $ndata = []; |
77 | - for ($j=0; $j<$ndim; $j++) { |
|
78 | - $transformer[] = function($val){ return [$val]; }; |
|
77 | + for ($j = 0; $j < $ndim; $j++) { |
|
78 | + $transformer[] = function($val) { return [$val]; }; |
|
79 | 79 | } |
80 | - foreach($this->sortedEncodedFeatures as $col) { |
|
80 | + foreach ($this->sortedEncodedFeatures as $col) { |
|
81 | 81 | $transformer[$col] = function($val) { return $this->featEncode[$col][$val]; }; |
82 | 82 | } |
83 | 83 | $ndata = []; |
84 | - for ($i=0; $i<$npoints; $i++) { |
|
84 | + for ($i = 0; $i < $npoints; $i++) { |
|
85 | 85 | $npoint = []; |
86 | - for ($j=0; $j<$ndim; $j++) { |
|
86 | + for ($j = 0; $j < $ndim; $j++) { |
|
87 | 87 | $npoint += $transformer[$j]($data[$i][$j]); |
88 | 88 | } |
89 | 89 | $ndata[] = $npoint; |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | /* |
95 | 95 | * @param |
96 | 96 | */ |
97 | - function decode($ndata){ |
|
97 | + function decode($ndata) { |
|
98 | 98 | $resp = []; |
99 | - for ($i=0; $i<$npoints; $i++) { |
|
99 | + for ($i = 0; $i < $npoints; $i++) { |
|
100 | 100 | //$point = array_fill(0, $nexpdim; null); |
101 | 101 | $point = array($ndata[$i]); |
102 | - foreach ( as $key => $val) { |
|
102 | + foreach (as $key => $val) { |
|
103 | 103 | $this->featDecode[$key]($point); |
104 | 104 | } |
105 | 105 | $point = $this->removeNulls($point); |