1
$\begingroup$

Very new in ML...

Actual problem is more complex, but I'll give it shorter.

Train data is a collection of samples, describing features of some items. There are many samples for each item. So ML model is implied to predict a few target variables, but one time for each item:

enter image description here

It appears, that I can't find in sklearn or a similar kit a way to fit model with this type of train-input/train-output. Is there any way to do this without hand-implementing whole pipeline?

I've considered this answer: How to predict based on multiple samples?

But I'm not sure it's applicable, since there are many-many samples for each item

Edit 1: Final model should get a few new samples for completely new item and predict same target variables

$\endgroup$

2 Answers 2

0
$\begingroup$

My first approach would be to repeat the target as many times as there are entries for an item. This would give you something like:

+-----+--------+-------+-------+-------+-------+---------+---------+
| ind | itemID | feat1 | feat2 | feat3 | feat4 | target1 | target2 |
+-----+--------+-------+-------+-------+-------+---------+---------+
|  0  |  6132  |   62  |  656  |  276  |  803  |    26   |   605   |
|  1  |  6132  |  184  |  662  |  235  |  740  |    26   |   605   |
|  2  |  6132  |   63  |  648  |  272  |  830  |    26   |   605   |
|  3  |  6132  |  111  |  637  |  253  |  831  |    26   |   605   |

etc.

Perhaps adding some noise over the target parameters could help in regularization, depending on the results.

The itemID feature probably needs to be encoded somehow if it is likely that this ID is not ordinal in any way. The tricky part will be here, as we certainly want to take benefit of the full dataset without making it a simple mean prediction.


Another approach could be to think of the problem as a semi-supervised learning task, but this will be more complicated so I would suggest to start with the first approach.

$\endgroup$
1
  • $\begingroup$ I'll mark this as the answer, even though I've ended up restructuring everything completely to avoid my initially desired learning. $\endgroup$ Commented Dec 3, 2019 at 15:47
0
$\begingroup$

Is there really any benefit than just creating three different models, and combining them at the end? If the end use case is just to predict the best final models, then I would just train on them individually.

You could have also do a NN with 3 output nodes, for each target. If you're just looking to do regression or something, I don't see why you wouldn't just predict them independently. There is some literature on multi-output regression (good summary here), but these involve scales of predicting high dimensional vectors(or even matrices), rather than just 3 numbers, so I don't know how useful this literature would be for your case, but that's where I would look if you're insistent on having a single model predict 3 outputs.

$\endgroup$
2
  • $\begingroup$ My bad that I didn't mention, but items themselves don't matter. There are many of them too. Final model should get a few new samples for completely new item and predict same target variables $\endgroup$ Commented Jul 5, 2019 at 18:18
  • $\begingroup$ @AlexLarionov I don't entirely understand your question, but I don't think there is going to be a convenient package in sklearn that can do what you are talking about. Please share if you find something. $\endgroup$ Commented Jul 8, 2019 at 13:00

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.