1
$\begingroup$

I have a data set listing attributes of clients - a combination of ordinal, categorical and interval data. I am also given the 5 nearest neighbors within the data set for and have to essentially reverse engineer an algorithm for the nearest neighbors.

Given the complexity of the data I'm quite lost as to how I can work out and then obtain parameters of a distance function. I apologize in advance for the vagueness of the question but I'm not even sure where to begin.

$\endgroup$
1
$\begingroup$

If I understand you correctly, based on the data and the given nearest neighbors, you need to decide what distance calculation was used to determine the nearest neighbors. It seems unlikely that you are being asked to create an altogether new distance measure, rather explore the different accepted distance measures.

If this is correct, it sounds like all you need to do is run the nearest neighbors recursively with different distance calculations and compare the results to the provided nearest neighbors to determine which measure created the 5 nearest neighbors you were given.

$\endgroup$
0
$\begingroup$

Okay, I didn't really understand your question but I am still taking a shot. Firstly, It depends on the fact that how separable your data is if classification is the goal. So, I would suggest doing some visualisations to get a sense of your data. You can usematplotlib if you are using python.
Interval data is going to be an issue, but depending on the data, you can make an assumption to use the middle value or better yet, see if you can create more features out of the interval, such as minimum value, maximum value etc. Now, since you have been gifted with the neighbors already, you can plot them and see how similar are they before you use any function to calculate the similarity. If they are indeed neighbors you will most likely observe a relationship between them. Since your goal is classification, and I am assuming you have no labels so you are looking at unsupervised classification. Clustering should be the first course of action, you can play around with the distance metrics, in Nearest Neighbors and through a bit of trial and error you will probably arrive at the distance function you are looking at. If you are only looking to figure out the distance function, it would be better if you take a small chunk of data and try some pairwise experiments with the data and the neighbors you have been given. This will be simpler and faster. You can check out the link I mentioned before to calculate pairwise distances as well.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.