Test Setup Failed
Pull Request — master (#375)
by Arkadiusz
02:14
created

AverageNode   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 39
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A outcome() 0 4 1
A impurity() 0 4 1
A samplesCount() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Phpml\Tree\Node;
6
7
class AverageNode extends BinaryNode implements PurityNode, LeafNode
8
{
9
    /**
10
     * @var float
11
     */
12
    private $outcome;
13
14
    /**
15
     * @var float
16
     */
17
    private $impurity;
18
19
    /**
20
     * @var int
21
     */
22
    private $samplesCount;
23
24
    public function __construct(float $outcome, float $impurity, int $samplesCount)
25
    {
26
        $this->outcome = $outcome;
27
        $this->impurity = $impurity;
28
        $this->samplesCount = $samplesCount;
29
    }
30
31
    public function outcome(): float
32
    {
33
        return $this->outcome;
34
    }
35
36
    public function impurity(): float
37
    {
38
        return $this->impurity;
39
    }
40
41
    public function samplesCount(): int
42
    {
43
        return $this->samplesCount;
44
    }
45
}
46