First of all I know what the Euclidean distance is and what it does or calculates between two vectors.
But my question is about how to calculate the distance between two class objects for example in Java or any other OOP-Language. I read pretty much stuff about machine learning already wrote a classifier using libraries etc. but I want to know how the Euclidean distance is calculated when I have for example this object:
class Object{
String name;
Color color;
int price;
int anotherProperty;
double something;
List<AnotherObject> another;
}
What I already know (If I am not wrong!) is that I have to convert this object to a(n) vector / array representing the properties or 'Features' (called in Machine Learning?)
But how can I do this? It is just this piece of puzzle which I need, to understand even more.
Do I have to collect all possible values for a property to convert it to a number and write it in the array/vector?
Example:
I guess the above object would be represented by an 6-dimensional array or smaller based on the 'Features' which are necessary to calculate. Let's say Color, Name and the price are those necessary features the array/vector based on the following data:
- color: green (Lets say an enum with 5 possible values where green is the third one)
- name: "foo" (I would not know how to convert this one maybe using addition of ascii code?)
- price: 14 (Just take the integer?)
would look like this?
[3,324,14]
And if I do this with every Object from the same class I am able to calculate the Euclidean distance. Am I right or did I misunderstand something, or is it completely wrong?