I have a multilabel classification problem with K
labels and also I have a function, let's call it f
that for each example in the dataset takes in two matrices, let's call them H
and P
. Both matrices are part of the input data.
For each vector of labels y
(for one example), i.e. y
is a vector with dimension (K \times 1)
, I compute a scalar value f_out = f(H, P, y)
.
I want to define a loss function that minimizes the mean absolute percentage error between the two vectors formed by the values f_out_true = f(H, P, y_true)
and f_out_pred = f(H, P, y_pred)
for all examples.
Seeing the documentation of Keras, I know that customized loss function comes in the form custmLoss(y_pred, y_true)
, however, the loss function I want to define depends on the input data and these values f_out_true
and f_out_pred
need to be computed example by example to form the two vectors that I want to minimize the mean absolute percentage error.