Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Lines | 8 |
Ratio | 50 % |
Changes | 0 |
1 | <?php |
||
86 | public function purityIncrease(): float |
||
87 | { |
||
88 | $impurity = $this->impurity; |
||
89 | |||
90 | View Code Duplication | if ($this->left() instanceof PurityNode) { |
|
|
|||
91 | $impurity -= $this->left()->impurity() |
||
92 | * ($this->left()->samplesCount() / $this->samplesCount); |
||
93 | } |
||
94 | |||
95 | View Code Duplication | if ($this->right() instanceof PurityNode) { |
|
96 | $impurity -= $this->right()->impurity() |
||
97 | * ($this->right()->samplesCount() / $this->samplesCount); |
||
98 | } |
||
99 | |||
100 | return $impurity; |
||
101 | } |
||
102 | |||
108 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.