In kNN, weighting allows neighbors closer to the data point to have more influence on the predicted value.
For numerical regression in Weka with IBk, the weighting is performed as shown in the linked method.
I have summarized the steps in the following pseudo code.
Step 0: prediction = 0, total = 0
Step 1:
For each of the k-neighbors:
Calculate distance to neighbor i
Calculate weight: weight = 1 / (distance)
Update prediction: prediction = prediction + neighbor i's class value * weight
- Update total: total = total + weight
Step 2: prediction = prediction / total
Step 3: return(prediction)