I have a set of houses with their features (location, size, number of rooms, etc … and the y is the price). In the future I will have a new house without the price. My goal is to find the 20 closest houses from this one.
I am working on a k-NN algorithm and I don’t take into account the prices of the other houses since when I’ll use the algorithm to retrieve the 20 most similar houses for a given house, I won’t have the price for this house. But each feature haven’t the same impact so I want to set the feature weights.
I was thinking about using a linear regression to determine the weight of each feature. The features will be x and the price y. And then I’ll keep the coefficient of the regression (the parameters) as the weight for my k-NN algorithm.
I haven’t find this kind of method to determine the weight of a feature. Is there a reason for that ? Or could it be a good approximation ? Do you recommend any other method to determine weights for a k-NN algorithm like this ?
Any input will be much appreciated !