Code Duplication    Length = 3-3 lines in 2 locations

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

@@ 108-110 (lines=3) @@
105
106
        // Set all target values to either -1 or 1
107
        $this->labels = [1 => $this->labels[0], -1 => $this->labels[1]];
108
        foreach ($targets as $target) {
109
            $this->targets[] = strval($target) == strval($this->labels[1]) ? 1 : -1;
110
        }
111
112
        // Set samples and feature count vars
113
        $this->samples = array_merge($this->samples, $samples);