1
$\begingroup$

Say one-hot encoding is the perfect way to represent a series of objects such as clothing items. Ie: A hat is [1 0 0], a tie is [0 1 0].

I want to predict what a customer buys if they spend a certain amount of money, which will serve as an input to the NN. Eg: For one example, the customer spends $22. The thing is, the customer may buy multiples of the same clothing item.

What would be the best way to make the neural network output something like [2 1 0] to show its prediction as 2 hats and 1 tie, given the input of $22?

As far as I understand binary crossentropy is good for multilabel problems, but nowhere could I find an example of how I could apply this when the same label occurs more than once.

The only solution I could think of was turning this into a regression problem, but doing so would seem bad since this is a categorical problem, and the network should output fixed natural numbers depending upon the number of times an object is predicted.

$\endgroup$
2
$\begingroup$

But your intuition about regression is right. Basically, you have multi target regression problem. Each category is a separate target. If your get float output as prediction, you can round it. Float output also makes sense, because it shows you how confident is your model about prediction and the expectation of the number of bought items.

Number of bought items is structured as ordinals, so it makes sense to predict it as multi target regression. Moreover, you may not know the upper limit of the number of bought items, so it makes no sense to predict number of items as categories.

Look at this for reference: Neural Network for Multiple Output Regression https://stats.stackexchange.com/questions/176515/resources-for-learning-about-multiple-target-techniques

| improve this answer | |
$\endgroup$
  • $\begingroup$ That makes sense come to think of it, thanks $\endgroup$ – user4779 Apr 19 '19 at 4:27
  • $\begingroup$ What would be the best way to implement this? I read the links and it seems a final dense layer with no activation would be ideal whilst using a MSE loss? Ie: If I have 8 classes, I could do something like.. y_classes = 8, .... model.add(Dense(y_classes,Activation=None) for the output layer? $\endgroup$ – user4779 Apr 19 '19 at 18:56
  • 1
    $\begingroup$ You just can either not to specify activation or use 'linear' activation $\endgroup$ – DmytroSytro Apr 21 '19 at 8:11

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.