Node Importance in scikit learn
weighted number of samples reaching node j

We have to compare the Parent to two children, then the children's impurity must be weighted.
Let's say the Parent has 100 samples and impurity=5
Children has the same data as [20, 2] and [80, 4]
Dip = 5 - (0.2 * 2 + 0.8 * 4)
=&gt; 5 - 3.6
=&gt; Dip = 1.4
&quot;Weighted&quot; means applying the appropriate ratio i.e. 0.2 and 0.8 here.