Conditions | 3 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
86 | public function purityIncrease(): float |
||
87 | { |
||
88 | $impurity = $this->impurity; |
||
89 | |||
90 | if ($this->left() instanceof PurityNode) { |
||
91 | $impurity -= $this->left()->impurity() |
||
92 | * ($this->left()->samplesCount() / $this->samplesCount); |
||
93 | } |
||
94 | |||
95 | if ($this->right() instanceof PurityNode) { |
||
96 | $impurity -= $this->right()->impurity() |
||
97 | * ($this->right()->samplesCount() / $this->samplesCount); |
||
98 | } |
||
99 | |||
100 | return $impurity; |
||
101 | } |
||
108 |