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

@@ 232-242 (lines=11) @@
229
     * @param array $sample
230
     * @param mixed $label
231
     */
232
    protected function predictProbability(array $sample, $label)
233
    {
234
        $predicted = $this->predictSampleBinary($sample);
235
236
        if (strval($predicted) == strval($label)) {
237
            $sample = $this->checkNormalizedSample($sample);
238
            return abs($this->output($sample));
239
        }
240
241
        return 0.0;
242
    }
243
244
    /**
245
     * @param array $sample