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
|
@@ 131-133 (lines=3) @@
|
128 |
|
|
129 |
|
// Set all target values to either -1 or 1 |
130 |
|
$this->labels = [1 => $this->labels[0], -1 => $this->labels[1]]; |
131 |
|
foreach ($targets as $target) { |
132 |
|
$this->targets[] = strval($target) == strval($this->labels[1]) ? 1 : -1; |
133 |
|
} |
134 |
|
|
135 |
|
// Set samples and feature count vars |
136 |
|
$this->samples = array_merge($this->samples, $samples); |