@@ -48,7 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | public function transform(array &$samples, ?array &$targets = null): void |
| 50 | 50 | { |
| 51 | - array_walk($samples, function (string &$sample): void { |
|
| 51 | + array_walk($samples, function(string &$sample): void { |
|
| 52 | 52 | $this->transformSample($sample); |
| 53 | 53 | }); |
| 54 | 54 | |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | |
| 19 | 19 | public function __construct(array $datasetColumns, array $filterColumns) |
| 20 | 20 | { |
| 21 | - $this->datasetColumns = array_map(static function (string $column): string { |
|
| 21 | + $this->datasetColumns = array_map(static function(string $column): string { |
|
| 22 | 22 | return $column; |
| 23 | 23 | }, $datasetColumns); |
| 24 | - $this->filterColumns = array_map(static function (string $column): string { |
|
| 24 | + $this->filterColumns = array_map(static function(string $column): string { |
|
| 25 | 25 | return $column; |
| 26 | 26 | }, $filterColumns); |
| 27 | 27 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | throw new InvalidArgumentException('At least one pipeline is required'); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - $this->pipelines = array_map(static function (Pipeline $pipeline): Pipeline { |
|
| 25 | + $this->pipelines = array_map(static function(Pipeline $pipeline): Pipeline { |
|
| 26 | 26 | return $pipeline; |
| 27 | 27 | }, $pipelines); |
| 28 | 28 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public function __construct(array $transformers, ?Estimator $estimator = null) |
| 25 | 25 | { |
| 26 | - $this->transformers = array_map(static function (Transformer $transformer): Transformer { |
|
| 26 | + $this->transformers = array_map(static function(Transformer $transformer): Transformer { |
|
| 27 | 27 | return $transformer; |
| 28 | 28 | }, $transformers); |
| 29 | 29 | $this->estimator = $estimator; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | throw new InvalidArgumentException('The array must have at least 2 elements'); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - $samplesPerClass = array_map(function (array $class): int { |
|
| 31 | + $samplesPerClass = array_map(function(array $class): int { |
|
| 32 | 32 | return count($class); |
| 33 | 33 | }, $samples); |
| 34 | 34 | $allSamples = (int) array_sum($samplesPerClass); |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | $dfbn = $classes - 1; |
| 42 | 42 | $dfwn = $allSamples - $classes; |
| 43 | 43 | |
| 44 | - $msb = array_map(function ($s) use ($dfbn) { |
|
| 44 | + $msb = array_map(function($s) use ($dfbn) { |
|
| 45 | 45 | return $s / $dfbn; |
| 46 | 46 | }, $ssbn); |
| 47 | - $msw = array_map(function ($s) use ($dfwn) { |
|
| 47 | + $msw = array_map(function($s) use ($dfwn) { |
|
| 48 | 48 | if ($dfwn === 0) { |
| 49 | 49 | return 1; |
| 50 | 50 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | private static function sumOfFeaturesPerClass(array $samples): array |
| 78 | 78 | { |
| 79 | - return array_map(function (array $class) { |
|
| 79 | + return array_map(function(array $class) { |
|
| 80 | 80 | $sum = array_fill(0, count($class[0]), 0); |
| 81 | 81 | foreach ($class as $sample) { |
| 82 | 82 | foreach ($sample as $index => $feature) { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - return array_map(function ($sum) { |
|
| 100 | + return array_map(function($sum) { |
|
| 101 | 101 | return $sum ** 2; |
| 102 | 102 | }, $squares); |
| 103 | 103 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | for ($i = 0; $i < count($this->nodes); $i++) { |
| 62 | 62 | $node = $this->nodes[$i]; |
| 63 | 63 | if ($node instanceof Neuron) { |
| 64 | - $iNode ++; |
|
| 64 | + $iNode++; |
|
| 65 | 65 | |
| 66 | 66 | if (count($characteristics) < $iNode + 1) { |
| 67 | 67 | throw new BadNeuralNetworkStructureException(); |