0
$\begingroup$

I'm using decision tree learning to try and classify a device based its components. Different devices have a different number of components and the location of these components within the device is important.

Device 1 might have components 9, 3, 8, 4, and 1 in that order. Then device 2 might have components 4, 3, 2, 6, and 7 in that order.

The issue with this is I'm finding it difficult to convert these into features.

I would have the features of each row be the locations and the value be the name of the component in that location but with some devices having few (<10) components and some with many more (>60) this could lead to many blank values.

I'm worried that when training if most of the training data is on devices with for example < 40 components, when trying to classify a device with > 40 components I'm assuming it would go terribly wrong, but you also can't just use devices with more than 40 components because then it will never learn to work for simple devices with smaller numbers of components.

If there is a technique or way to get around this please let me know! Or if I've come at this problem the wrong way and need to rethink let me know that as well!

$\endgroup$
  • $\begingroup$ Different number of attributes means you would be comparing apples to oranges. Either what you are analyzing is not comparable and you need to divide your analysis into independent subsets or you need to input all the variables and then deal with the missing values. $\endgroup$ – user2974951 Dec 12 '18 at 10:57
0
$\begingroup$

I think you need to create a dataset with features covering all component / position options - i.e. create a dataset that is 60+ columns wide. This dataset would contain observations for both larger and smaller devices (you might want to take care in the balance between small and large devices). This is because many ML techniques require datasets of the same structure to be used in training and prediction.

In this dataset you may have many observations where the features are 0 or blank (e.g. smaller devices). Depending on the decision tree implementation you are using, you might have to perform some data cleaning to deal with the blank features.

From your question, I think you're approaching the problem the right way. I would say that if you're interested finding out the feature importance you might need to switch out features. As an example, if you're interested in finding out which component is most predictive of a device, you might want to have the columns of your dataset representing component number (and vice versa if you're interested in finding out which position is most predictive of a device).

| improve this answer | |
$\endgroup$
0
$\begingroup$

A lot of blank values in row isn't a problem, you can use sparse matrices.

I suppose you have a dataset to work with. So you can use validation and check some your suspicions. For example: fit model using dataset with <40 components and test it on another part of data.

Trying to consider order of components within device is challenging task. Maybe you can add pairs of components as features...

This is just my suggestions, I'm not an experienced data scientist =)

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ I don't have a dataset yet. I tried to create one for the time being and the tree seemed to perform decently. I just don't want to sink a days worth of work into getting the data and formatting it correctly to find out it's not going to work! $\endgroup$ – A.White Dec 12 '18 at 15:12

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.