I want to build a machine learning model where each feature has further multiple attributes.

Apologies for the lame example, but this will convey my doubt:

Predict the animal on the basis of its fingers(let's say 5 fingers of one paw of that animal). In this case, 5 fingers are the features and each finger has its length, width, and nail-length as attributes.

The following table describes one example. Let's say this example corresponds to lion.

Length Breadth Nail-length
Finger-1 3 cm 2 cm 1.5 cm
Finger-2 4 cm 3 cm 2 cm
Finger-3 3.5 cm 1.5 cm 2.5 cm
Finger-4 xx cm xx cm xx cm
Finger-5 xx cm xx cm xx cm

Now, these 5-fingers are one set of information. How can I convert this to a feature without losing any information? I cannot split this information because for each finger the length, breadth, and nail-length are unique.


1 Answer 1


Flattening the information is most common and intuitive choice, before trying something else. So, the new features will look like

Finger-1-Length, Finger-1-Breadth, Finger-1-Nail-length, Finger-2-Length, Finger-2-Breadth, Finger-2-Nail-length ... and so on.

This gives you a 15 dimensional feature space.

  • $\begingroup$ Wouldn't then some vital information would be lost? Some other animal having the same data but in different combinations will be forced to be considered as same. $\endgroup$
    – Vipul
    Commented Mar 13, 2022 at 11:03
  • $\begingroup$ I'm not sure I understand what's lost in this representation. $\endgroup$
    – gunes
    Commented Mar 13, 2022 at 11:04
  • $\begingroup$ I mean how will the model know that finger-1-length, finger-1-breadth and finger-1-nail-length are related? $\endgroup$
    – Vipul
    Commented Mar 13, 2022 at 11:06
  • $\begingroup$ Well, similarly, finger 1 and finger 2 can be related as well. There may always be dependency between the features, and some machine learning methods already addresses them if they're needed or useful (e.g. non-naive bayesian methods). $\endgroup$
    – gunes
    Commented Mar 13, 2022 at 11:08
  • $\begingroup$ Thanks a lot :) Is there a way to tell the model that finger-1-length, finger-1-breadth, and finger-1-nail-length belong to one group? Suppose I add another column finger-type like thumb, forefinger etc. This data will be lost after flatenning. $\endgroup$
    – Vipul
    Commented Mar 13, 2022 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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