How to train a neural network to minimize two loss functions? For TF/Keras (or in general), what is the best way to define a multidimensional y target? Should this even be done?
The problem:
Any sample x tries to predict several "values of interest". These values are returned as simple floats. Each value also has a corresponding category (binary) that classifies the value. Note that the binary classification corresponds to class A or B not a "yes" or "no".
y = [[1.0451 0], [1.1469, 1], [1.3571, 1], [1.0451, 0]]

Note that for my particular problem (which might be relevant to the posted problem), each y label has a different # of elements up to 5 (elements without values are zero padded [0, 0].
A possible solution:
Flatten y into a single vector. From your experience, how well do NN's establish the type of relationship between values like above?
 A: I understand the question as asking

If we have a loss $L_1$ which is the regression portion and another loss $L_2$ which is the classification portion, how do we train a NN to minimize both?

This touches on the optimization topic of multi-objective optimization, for which one approach is finding the pareto optimal solution. A simple approach would be for Ayma to  choose some $0 \le \theta \le 1$ and minimize $\mathcal{L} = \theta L_1 + (1 - \theta) L_2$.
Because $\mathcal{L}$ is a convex combination of $L_1$ and $L_2$, we are training a model which finds a compromise between minimizing $L_1$ and minimzing $L_2$, with the extent of the compromise chosen by $\theta$. Setting $\theta = 0$ only trains the classifier, setting $\theta=1$ only trains the regressor, and setting $\theta$ in between chooses some mix of both.
I would suggest training several models with alternative choices of $\theta$ and assessing which ones solve your problem best.
I can't find the reference that I'm thinking of, but sometimes having multiple targets in the same model can be helpful because the added information from the second target helps the model predict the first target better, compared to a model that has the first target as the only target. In other words, having 2 models for each of the 2 targets might be worse than using 1 model for both.
And the hypothesis that using both losses in combination is better than using a single loss by itself can be tested: train a model to predict each target singly, and compare those models to the single model with 2 targets.
