I have a dataset that has (among others) a categorical variable with many levels and further attributes associated with each level.
For example, consider predicting machine failure based on its last repair report.
- A machine has many (many) different parts.
- Every part could have been damaged or not.
- If damaged, it could have been inspected, repaired or replaced etc.
- These operations have associated costs and the part itself has a money value and other attributes (like the time it took to repair it...).
- If damaged, it could have been inspected, repaired or replaced etc.
- Every part could have been damaged or not.
If I want to make predictions on the level of a machine, I need to aggregate all this information. I could one-hot encode all the parts indicating whether they have been damaged or not. But this still leaves me with the other attributes on the lower part level, like price and performed operation. I could probably further expand them into individual columns by considering all the combinations like part_X-repaired-..-price, part_X-replaced-..-price, ... part_Z-replaced-..-price
but this seems to get out of hand.
Is there a better way to handle this type of data? I was thinking maybe some clustering technique but when I try to set it up I run into the same problem.
It is somewhat a reversed hierarchical model structure (in hierarchical (linear) models the outcome variable is on the lowest level if I'm not mistaking).