src/Phpml/Classification/Ensemble/AdaBoost.php 1 location
|
@@ 110-112 (lines=3) @@
|
| 107 |
|
|
| 108 |
|
// Set all target values to either -1 or 1 |
| 109 |
|
$this->labels = [1 => $this->labels[0], -1 => $this->labels[1]]; |
| 110 |
|
foreach ($targets as $target) { |
| 111 |
|
$this->targets[] = $target == $this->labels[1] ? 1 : -1; |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
$this->samples = array_merge($this->samples, $samples); |
| 115 |
|
$this->featureCount = count($samples[0]); |
src/Phpml/Classification/Linear/Perceptron.php 1 location
|
@@ 113-115 (lines=3) @@
|
| 110 |
|
|
| 111 |
|
// Set all target values to either -1 or 1 |
| 112 |
|
$this->labels = [1 => $this->labels[0], -1 => $this->labels[1]]; |
| 113 |
|
foreach ($targets as $target) { |
| 114 |
|
$this->targets[] = strval($target) == strval($this->labels[1]) ? 1 : -1; |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
// Set samples and feature count vars |
| 118 |
|
$this->samples = array_merge($this->samples, $samples); |