5
$\begingroup$

I am new to DL and Keras. I am trying to solve a regression problem with multivariate outputs (y shape (?, 2)) using Keras (tensorflow backend). I am having my confusion about how the loss is calculated. I use mean absolute error as the loss function. However, since my target data has 2 dimensions, is the loss value calculated as the reduced mean on all dimensions (a scalar as the result)? I checked the Keras source code, it uses K.mean(..., axis=-1) for MAE calculation. If K.mean is the same to numpy.mean, "axis=-1" should do the column mean (for my case, it should return a tensor with shape (?,2) but not a scalar). If this is the case, how could the loss value be a single number (as outputed in the training process log)?

If the MAE return is indeed a scalar (reduced mean), this gives me another problem. The data from each dimension of my target is not in a same range. A reduced mean would be biased towards the high value dimension. Shall I change my model to a multi-task learning model then?

Thanks a lot for your help on this.

L.

$\endgroup$
0
$\begingroup$

I fall on same issue with RMSE which by the way may be a good complementary choice of MAE. Thus in order to measure error prediction on multidimentional output the way i implemented was as follow. Measure the index score per dimension then do the average on all dimensions which gives a single scalar value. If your data isn t on same scale, apply a standardization on it. And in order to have same order of magnitude on all your output dimensions you also can divide each column by their corresponding test set standard deviation before applying the mean reduce.

$\endgroup$

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.