For one sorted numeric feature, this lesson checks exact midpoint candidates and scores each split with weighted Gini.

highlighted = computed this step

Sort rows and make midpoints

Sort the displayed column: x=1 has label A, x=2 has label A, x=4 has label B, and x=5 has label B. Candidate thresholds sit halfway between adjacent x values.

t{3/2,3,9/2}t\in\{3/2,3,9/2\}
Candidate thresholdsMidpoints and weighted Gini values are derived from the sorted rows.Threshold candidatessorted rows: x=1:A, x=2:A, x=4:B, x=5:Bbetweenmidpoint tleft countsright countsweighted Gininote1 | 2(1+2)/2=3/2[1, 0][1, 2]1/32 | 4(2+4)/2=3[2, 0][0, 2]0smallest4 | 5(4+5)/2=9/2[2, 1][0, 1]1/3among shown candidates, t=3 has the smallest weighted Ginione tiny sorted column; one stated candidate policyNOT continuous optimization; NOT training-to-generalization; NOT every tree packageNOT future data

Score each candidate split

The three weighted Gini scores are 1/3, 0, and 1/3. Each row is recomputed from the labels on each side of the threshold.

Gw(3/2)=1/3,Gw(3)=0,Gw(9/2)=1/3G_w(3/2)=1/3,\quad G_w(3)=0,\quad G_w(9/2)=1/3
Candidate thresholdsMidpoints and weighted Gini values are derived from the sorted rows.Threshold candidatessorted rows: x=1:A, x=2:A, x=4:B, x=5:Bbetweenmidpoint tleft countsright countsweighted Gininote1 | 2(1+2)/2=3/2[1, 0][1, 2]1/32 | 4(2+4)/2=3[2, 0][0, 2]0smallest4 | 5(4+5)/2=9/2[2, 1][0, 1]1/3among shown candidates, t=3 has the smallest weighted Ginione tiny sorted column; one stated candidate policyNOT continuous optimization; NOT training-to-generalization; NOT every tree packageNOT future data

Choose among these shown candidates

Among these shown candidates, t=3 has the smallest weighted Gini. This is one tiny sorted column and one stated candidate policy, not continuous optimization, not training-to-generalization, and not a claim about every tree package or future data.

min{1/3,0,1/3}=0\min\{1/3,0,1/3\}=0
Candidate thresholdsMidpoints and weighted Gini values are derived from the sorted rows.Threshold candidatessorted rows: x=1:A, x=2:A, x=4:B, x=5:Bbetweenmidpoint tleft countsright countsweighted Gininote1 | 2(1+2)/2=3/2[1, 0][1, 2]1/32 | 4(2+4)/2=3[2, 0][0, 2]0smallest4 | 5(4+5)/2=9/2[2, 1][0, 1]1/3among shown candidates, t=3 has the smallest weighted Ginione tiny sorted column; one stated candidate policyNOT continuous optimization; NOT training-to-generalization; NOT every tree packageNOT future data