# Regression Trees: how to split if node has 2 samples

• Sorry, but this is not a general question, so i am going to be as specific as i can. I have searched a lot, however i cant consider the following case in regression trees:

• The following picture shows one node, which has 2 Samples. The black rectangles are the split nodes and the green circles are the leaf nodes • In each node, the split is made by using the SSE(Residual Sum Of Square Error)

• I have problem in calculating the split, when the num of samples in a node is 2. This happens because the SSE calculates the mean values in each subtree of this node. So, the SSE will be always zero

(leftSubtreeError-meanLeft)^2 + (rightSubtreeError-meanRight)^2 = (leftSubtreeError-leftSubtreeError)^2 + (rightSubtreeError-rightSubtreeError)^2 = 0^2 + 0^2 = 0

• Also each leaf node will always have 1 sample

• The split is done according to 3 variables:

a. px1(height,width)

b. px2(height,width)

c. thres, where 1 <= thres <= 50

• So, if the number of samples in a node is 2, does it make sense using the above split variables? no

• Maybe i am missing some part of algorithm. Is there any exception in the algorithm?

It is possible, and relatively common, to add safeguards against this kind of situation, this amounts to a form of regularization. For example, you could automatically reject any proposed split on a node withe less than $N$ observations, or disallow the creating of any leaf nodes with less than $N$ observations.