Consider a sample (10,14) and let (8,11) be its nearest neighbour. |
(10,14) is the sample for which k-nearest neighbours are being identified. |
(8,11) is one of its k-nearest neighbours. |
Let us consider: \(x_{1,1} = 10\), \(x_{1,2} = 14 \), \(x_{1,2} - x_{1,1} = 4\) \(x_{2,1} = 8\), \(x_{2,2} = 11 \), \(x_{2,2} - x_{2,1} = 3\) |
The new samples are generated as \((x_{1}^{\prime },x_{2}^{\prime }) = (10,14) + \mathrm{rand}(0,1) * (4,3)\) rand(0,1) generates a random number between 0 and 1. |