Code Duplication    Length = 3-3 lines in 2 locations

src/Phpml/Classification/Ensemble/AdaBoost.php 1 location

@@ 85-87 (lines=3) @@
82
83
        // Set all target values to either -1 or 1
84
        $this->labels = [1 => $this->labels[0], -1 => $this->labels[1]];
85
        foreach ($targets as $target) {
86
            $this->targets[] = $target == $this->labels[1] ? 1 : -1;
87
        }
88
89
        $this->samples = array_merge($this->samples, $samples);
90
        $this->featureCount = count($samples[0]);

src/Phpml/Classification/Linear/Perceptron.php 1 location

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