Code Duplication    Length = 11-11 lines in 2 locations

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

@@ 264-274 (lines=11) @@
261
     * @param array $sample
262
     * @param mixed $label
263
     */
264
    protected function predictProbability(array $sample, $label)
265
    {
266
        $predicted = $this->predictSampleBinary($sample);
267
268
        if (strval($predicted) == strval($label)) {
269
            $sample = $this->checkNormalizedSample($sample);
270
            return abs($this->output($sample) - 0.5);
271
        }
272
273
        return 0.0;
274
    }
275
}
276

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

@@ 208-218 (lines=11) @@
205
     * @param array $sample
206
     * @param mixed $label
207
     */
208
    protected function predictProbability(array $sample, $label)
209
    {
210
        $predicted = $this->predictSampleBinary($sample);
211
212
        if (strval($predicted) == strval($label)) {
213
            $sample = $this->checkNormalizedSample($sample);
214
            return abs($this->output($sample));
215
        }
216
217
        return 0.0;
218
    }
219
220
    /**
221
     * @param array $sample