I have a multi-class neural network classifier that has K classes(products). For every row, only one of the classes will be 1 at a time. Now, this approach works fine if I have only 1 objective to optimize i.e Which of these N products was "clicked" by the user.

But how will I solve this problem if I need to optimize on a 2nd objective i.e Which of these N products was "purchased" by the user?

A purchase event is always preceded by a click event. I can obviously solve this problem by training two separate models - 1 for click and the other for purchase. But purchase data is very low as compared to the click data. And we ran the purchase model on production. It did not perform well.

So how do I take both the click and purchase data and frame my problem as "Which of these N products will be clicked and possibly purchased by the user"? and train a single model.

Any sources or papers in this direction will be really helpful.

  • 1
    $\begingroup$ Maybe i'm misunderstanding what you're trying to do, but from what i understand i would suggest to build a new class corresponding to when a product is clicked and buy. Doing so, you just create a new multi-class problem. But maybe i'm misunderstanding. $\endgroup$ Nov 25, 2020 at 13:38

1 Answer 1


What you're referring to is called multi-task learning, where your goal is to have a single network learn multiple tasks (in your case "click" and "purchase").

The benefit of having a single model learn both tasks is that the network can use information extracted for one task to improve its performance on the other.

Technically you need your network to have two output layers (i.e. one for predicting "clicks" and one for "purchases") and likewise two loss functions (one for each objective). These loss functions usually contribute equally towards the total loss, unless you don't want to consider both tasks of equal importance.

If you're using keras an example for multi-output models can be found here.


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.